Skip to content

Commit

Permalink
laravel 10 updates
Browse files Browse the repository at this point in the history
  • Loading branch information
vmcvlad committed Feb 26, 2024
1 parent 7e568e8 commit e042423
Show file tree
Hide file tree
Showing 38 changed files with 576 additions and 720 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
VITE_APP_NAME="${APP_NAME}"

OWNER_COMPANY_ID=1

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Homestead.yaml
.php_cs.cache
npm-debug.log
yarn-error.log
.phpunit.cache

# code editors
/.idea
Expand Down
4 changes: 2 additions & 2 deletions app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Kernel extends ConsoleKernel

private Schedule $schedule;

protected function schedule(Schedule $schedule)
protected function schedule(Schedule $schedule): void
{
if (App::runningUnitTests()) {
return;
Expand All @@ -28,7 +28,7 @@ protected function schedule(Schedule $schedule)
}
}

protected function commands()
protected function commands(): void
{
$this->load(__DIR__.'/Commands');

Expand Down
13 changes: 3 additions & 10 deletions app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,10 @@ class Handler extends ExceptionHandler

public function report(Throwable $exception)
{
if (App::bound('sentry') && $this->shouldReport($exception)) {
Sentry::report($exception);
}
// if (App::bound('sentry') && $this->shouldReport($exception)) {
// Sentry::report($exception);
// }

parent::report($exception);
}

// public function register()
// {
// $this->reportable(function (Throwable $e) {
//
// });
// }
}
5 changes: 3 additions & 2 deletions app/Http/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,19 @@ class Kernel extends HttpKernel
'api' => [
\LaravelEnso\Core\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
'throttle:api',
\Illuminate\Routing\Middleware\ThrottleRequests::class.':api',
],
];

protected $routeMiddleware = [
protected $middlewareAliases = [
'auth' => \App\Http\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
'precognitive' => \Illuminate\Foundation\Http\Middleware\HandlePrecognitiveRequests::class,
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
Expand Down
5 changes: 3 additions & 2 deletions app/Http/Middleware/Authenticate.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
namespace App\Http\Middleware;

use Illuminate\Auth\Middleware\Authenticate as Middleware;
use Illuminate\Http\Request;

class Authenticate extends Middleware
{
protected function redirectTo($request)
protected function redirectTo(Request $request): ?string
{
return route('login');
return $request->expectsJson() ? null : route('login');
}
}
3 changes: 2 additions & 1 deletion app/Http/Middleware/RedirectIfAuthenticated.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Symfony\Component\HttpFoundation\Response;

class RedirectIfAuthenticated
{
public function handle(Request $request, Closure $next, ...$guards)
public function handle(Request $request, Closure $next, string ...$guards): Response
{
$guards = empty($guards) ? [null] : $guards;

Expand Down
2 changes: 1 addition & 1 deletion app/Http/Middleware/TrustHosts.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class TrustHosts extends Middleware
{
public function hosts()
public function hosts(): array
{
return [
$this->allSubdomainsOfApplicationUrl(),
Expand Down
5 changes: 0 additions & 5 deletions app/Providers/AuthServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,4 @@
class AuthServiceProvider extends ServiceProvider
{
protected $policies = [];

public function boot()
{
$this->registerPolicies();
}
}
2 changes: 1 addition & 1 deletion app/Providers/RouteServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class RouteServiceProvider extends ServiceProvider
{
public const HOME = '/';

public function boot()
public function boot(): void
{
$this->configureRateLimiting();

Expand Down
31 changes: 31 additions & 0 deletions app/Upgrades/PasswordResetTokens.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace App\Upgrades;

use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
use LaravelEnso\Upgrade\Contracts\BeforeMigration;
use LaravelEnso\Upgrade\Contracts\MigratesData;
use LaravelEnso\Upgrade\Contracts\MigratesTable;

class PasswordResetTokens implements MigratesTable, MigratesData, BeforeMigration
{
public function isMigrated(): bool
{
return Schema::hasTable('password_reset_tokens', 'expires_at');
}

public function migrateTable(): void
{
Schema::rename('password_resets', 'password_reset_tokens');
}

public function migrateData(): void
{
DB::table('migrations')
->whereMigration('2014_10_12_100000_create_password_resets_table')
->update([
'migration' => '2014_10_12_100000_create_password_reset_tokens_table',
]);
}
}
22 changes: 22 additions & 0 deletions app/Upgrades/SancumV3.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace App\Upgrades;

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use LaravelEnso\Upgrade\Contracts\MigratesTable;

class SancumV3 implements MigratesTable
{
public function isMigrated(): bool
{
return Schema::hasColumn('personal_access_tokens', 'expires_at');
}

public function migrateTable(): void
{
Schema::table('personal_access_tokens', function (Blueprint $table) {
$table->timestamp('expires_at')->nullable()->after('last_used_at');
});
}
}
20 changes: 12 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "laravel-enso/enso",
"type": "project",
"description": "Laravel Enso can be a solid start for any SPA based on Laravel 7.x, Vue and Bulma",
"description": "Laravel Enso can be a solid start for any SPA based on Laravel 10.x, Vue and Bulma",
"keywords": [
"framework",
"laravel"
Expand Down Expand Up @@ -37,20 +37,24 @@
"require-dev": {
"fakerphp/faker": "^1.9.1",
"barryvdh/laravel-debugbar": "^3.5",
"brianium/paratest": "^6.3",
"brianium/paratest": "^7.4",
"filp/whoops": "^2.1.0",
"laravel-enso/cli": "^5.0",
"laravel-enso/phpunit-pretty-print": "^1.0",
"laravel-enso/phpunit-pretty-print": "^1.2",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^6.1",
"nunomaduro/collision": "^7.0",
"nunomaduro/phpinsights": "dev-master",
"phpunit/phpunit": "^9.5.10",
"phpunit/phpunit": "^10.0",
"spatie/laravel-ignition": "^2.0"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
"sort-packages": true,
"allow-plugins": {
"php-http/discovery": true,
"dealerdirect/phpcodesniffer-composer-installer": true
}
},
"extra": {
"laravel": {
Expand All @@ -72,7 +76,7 @@
"LaravelEnso\\Tables\\Tests\\": "vendor/laravel-enso/tables/tests/"
}
},
"minimum-stability": "dev",
"minimum-stability": "stable",
"prefer-stable": true,
"scripts": {
"post-autoload-dump": [
Expand All @@ -93,4 +97,4 @@
"php artisan enso:upgrade:status"
]
}
}
}
Loading

0 comments on commit e042423

Please sign in to comment.