Skip to content

Commit

Permalink
Merge pull request #290 from zuzana-kunckova/laravel-upgrade
Browse files Browse the repository at this point in the history
Laravel version 11 upgrade
  • Loading branch information
JonoB authored Apr 19, 2024
2 parents 7ee9866 + 8c32e9e commit fc5c504
Show file tree
Hide file tree
Showing 96 changed files with 369 additions and 617 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
on: push
name: Laravel CI
jobs:
phpunit:
runs-on: ubuntu-latest
strategy:
matrix:
container: [
"kirschbaumdevelopment/laravel-test-runner:8.2",
"kirschbaumdevelopment/laravel-test-runner:8.3"
]

container:
image: ${{ matrix.container }}

name: ${{ matrix.container }}

services:
mysql:
image: mysql:5.7
env:
MYSQL_ROOT_PASSWORD: password
MYSQL_USER: homestead
MYSQL_PASSWORD: secret
MYSQL_DATABASE: sendportal_dev
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

postgres:
image: postgres
env:
POSTGRES_USER: homestead
POSTGRES_PASSWORD: secret
POSTGRES_DB: sendportal_dev
ports:
- 5432:5432
options: --health-cmd="pg_isready" --health-interval=10s --health-timeout=5s --health-retries=3

steps:
- uses: actions/checkout@v3
- name: Install composer dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
- name: Run Testsuite against MySQL
run: vendor/bin/phpunit
env:
DB_CONNECTION: mysql
DB_HOST: mysql
DB_PORT: 3306
- name: Run Testsuite against Postgres
run: vendor/bin/phpunit
env:
DB_CONNECTION: pgsql
DB_HOST: postgres
DB_PORT: 5432
29 changes: 29 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Format [PHP]

on:
pull_request:
paths:
- '**.php'

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
php-cs-fixer:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}

- name: Run php-cs-fixer
uses: docker://oskarstark/php-cs-fixer-ga:3.13.0
with:
args: --config=.php-cs-fixer.dist.php

- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Apply php-cs-fixer changes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Sendportal

## 3.0.0 - 2024-04-19
- Update to Laravel 11 ([#290](https://github.com/mettle/sendportal/pull/290)

## 2.0.3 - 2021-07-05
- Allow overwrite phpunit.xml only locally ([#148](https://github.com/mettle/sendportal/pull/148))

Expand Down
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,16 @@ The [SendPortal](https://github.com/mettle/sendportal) application acts as a wra

## Installation

As of Version 2, SendPortal can be installed as a stand-alone application (i.e. including everything you need to run SendPortal), or as a package inside an existing Laravel application.

If you would like to install SendPortal as a stand-alone application, please follow the [installation guide](https://sendportal.io/docs/v2/getting-started/installation).

If you would like to add SendPortal to an existing application, please follow the [package installation guide](https://sendportal.io/docs/v2/getting-started/package-installation).

## Upgrading
## Requirements
SendPortal V3 requires:

- PHP 8.2+
- Laravel 10+
- MySQL (≥ 5.7) or PostgreSQL (≥ 9.4)

If you are on an earlier version of PHP (7.3+) or Laravel (8+), please use [SendPortal V2](https://github.com/mettle/sendportal/releases/tag/v2.0.4)

If you already have a copy of SendPortal v1 installed, please follow the [upgrade guide](https://sendportal.io/docs/v2/getting-started/upgrade-guide).
28 changes: 14 additions & 14 deletions app/Console/Commands/InstallApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ protected function checkEnvironment(): void
*/
protected function checkApplicationKey(): void
{
if ( ! config('app.key')) {
if (! config('app.key')) {
$this->call('key:generate');
}

Expand All @@ -103,7 +103,7 @@ protected function checkApplicationKey(): void
protected function checkAppUrl(): void
{
if (config('app.url') !== 'http://localhost') {
$this->info('✓ Application url set to ' . config('app.url'));
$this->info('✓ Application url set to '.config('app.url'));

return;
}
Expand All @@ -121,7 +121,7 @@ protected function checkDatabaseConnection(): void
$this->info('✓ Database connection successful');
} catch (Exception $e) {
try {
if ( ! $this->createDatabaseCredentials()) {
if (! $this->createDatabaseCredentials()) {
$this->error(
'A database connection could not be established. Please update your configuration and try again.'
);
Expand All @@ -144,7 +144,7 @@ protected function createDatabaseCredentials(): bool
true
);

if ( ! $storeCredentials) {
if (! $storeCredentials) {
return false;
}

Expand Down Expand Up @@ -211,7 +211,7 @@ protected function getCompanyName(): string
$this->line('Creating first admin user account and company/workspace');
$companyName = $this->ask('Company/Workspace name');

if ( ! $companyName) {
if (! $companyName) {
return $this->getCompanyName();
}

Expand Down Expand Up @@ -271,7 +271,7 @@ protected function getUserParam(string $param): string

if ($validator->fails()) {
foreach ($validator->errors()->getMessages() as $error) {
$this->line((string)($error[0]));
$this->line((string) ($error[0]));
}

return $this->getUserParam($param);
Expand Down Expand Up @@ -312,7 +312,7 @@ protected function checkVendorAssets(): void
[
'--provider' => SendportalBaseServiceProvider::class,
'--tag' => 'sendportal-assets',
'--force' => true
'--force' => true,
]
);

Expand All @@ -329,11 +329,11 @@ protected function printDatabaseConfig(): void
$this->line('');
$this->info('Database Configuration:');
$this->line("- Connection: {$connection}");
$this->line('- Host: ' . config("database.connections.{$connection}.host"));
$this->line('- Port: ' . config("database.connections.{$connection}.port"));
$this->line('- Database: ' . config("database.connections.{$connection}.database"));
$this->line('- Username: ' . config("database.connections.{$connection}.username"));
$this->line('- Password: ' . config("database.connections.{$connection}.password"));
$this->line('- Host: '.config("database.connections.{$connection}.host"));
$this->line('- Port: '.config("database.connections.{$connection}.port"));
$this->line('- Database: '.config("database.connections.{$connection}.database"));
$this->line('- Username: '.config("database.connections.{$connection}.username"));
$this->line('- Password: '.config("database.connections.{$connection}.password"));
}

/**
Expand All @@ -344,7 +344,7 @@ protected function persistVariables(array $connectionData): void
$connection = $connectionData['DB_CONNECTION'];

$configMap = [
'DB_CONNECTION' => "database.default",
'DB_CONNECTION' => 'database.default',
'DB_HOST' => "database.connections.{$connection}.host",
'DB_PORT' => "database.connections.{$connection}.port",
'DB_DATABASE' => "database.connections.{$connection}.database",
Expand Down Expand Up @@ -374,7 +374,7 @@ protected function writeToEnvironmentFile(string $key, ?string $value): void
)
);

if ( ! $this->checkEnvValuePresent($key, $value)) {
if (! $this->checkEnvValuePresent($key, $value)) {
throw new RuntimeException("Failed to persist environment variable value. {$key}={$value}");
}
}
Expand Down
4 changes: 1 addition & 3 deletions app/Console/Commands/UpgradeApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ class UpgradeApplication extends BaseCommand

/**
* Execute the console command.
*
* @return int
*/
public function handle(): int
{
Expand All @@ -62,7 +60,7 @@ protected function checkVendorAssets(): void
'vendor:publish',
[
'--provider' => SendportalBaseServiceProvider::class,
'--force' => true
'--force' => true,
]
);

Expand Down
1 change: 0 additions & 1 deletion app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ class Kernel extends ConsoleKernel
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
Expand Down
2 changes: 0 additions & 2 deletions app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class Handler extends ExceptionHandler
/**
* Report or log an exception.
*
* @param \Throwable $exception
* @return void
*
* @throws \Exception
Expand All @@ -43,7 +42,6 @@ public function report(Throwable $exception)
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Throwable $exception
* @return \Symfony\Component\HttpFoundation\Response
*
* @throws \Throwable
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Auth/ChangePasswordController.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function edit(): View
public function update(ChangePasswordRequest $request): RedirectResponse
{
$request->user()->update([
'password'=> Hash::make($request->password)
'password' => Hash::make($request->password),
]);

return redirect()->route('profile.show')
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Auth/ConfirmPasswordController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace App\Http\Controllers\Auth;

use Illuminate\Foundation\Auth\ConfirmsPasswords;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ConfirmsPasswords;

class ConfirmPasswordController extends Controller
{
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Auth/ForgotPasswordController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace App\Http\Controllers\Auth;

use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;

class ForgotPasswordController extends Controller
{
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Auth/LoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use Illuminate\Contracts\View\View;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use App\Http\Controllers\Controller;

class LoginController extends Controller
{
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Auth/ProfileController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

namespace App\Http\Controllers\Auth;

use Illuminate\Contracts\View\View;
use Illuminate\Http\RedirectResponse;
use App\Http\Controllers\Controller;
use App\Http\Requests\ProfileUpdateRequest;
use Illuminate\Contracts\View\View;
use Illuminate\Http\RedirectResponse;

class ProfileController extends Controller
{
Expand Down
21 changes: 10 additions & 11 deletions app/Http/Controllers/Auth/RegisterController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,24 @@

namespace App\Http\Controllers\Auth;

use Illuminate\Contracts\Validation\Validator as ValidatorContract;
use Illuminate\Foundation\Auth\RegistersUsers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Str;
use App\Http\Controllers\Controller;
use App\Models\Workspace;
use App\Models\User;
use App\Models\Workspace;
use App\Rules\ValidInvitation;
use App\Services\Workspaces\AcceptInvitation;
use App\Services\Workspaces\CreateWorkspace;
use App\Traits\ChecksInvitations;
use Illuminate\Contracts\Validation\Validator as ValidatorContract;
use Illuminate\Foundation\Auth\RegistersUsers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;

class RegisterController extends Controller
{
use RegistersUsers,
ChecksInvitations;
use ChecksInvitations,
RegistersUsers;

/** @var AcceptInvitation */
private $acceptInvitation;
Expand Down Expand Up @@ -59,7 +58,7 @@ protected function validator(array $data): ValidatorContract
'name' => ['required', 'string', 'max:255'],
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
'password' => ['required', 'string', 'min:8'/*, 'confirmed'*/],
'invitation' => [new ValidInvitation()]
'invitation' => [new ValidInvitation()],
]);
}

Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Auth/ResetPasswordController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ResetsPasswords;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class ResetPasswordController extends Controller
{
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Auth/VerificationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\VerifiesEmails;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class VerificationController extends Controller
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

namespace App\Http\Controllers\Workspaces;

use Illuminate\Http\Request;
use App\Models\Workspace;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;

class SwitchWorkspaceController
{
Expand Down
Loading

0 comments on commit fc5c504

Please sign in to comment.