diff --git a/.cursor/rules/laravel-boost.mdc b/.cursor/rules/laravel-boost.mdc index dad9e44..dcac8e3 100644 --- a/.cursor/rules/laravel-boost.mdc +++ b/.cursor/rules/laravel-boost.mdc @@ -24,6 +24,7 @@ This application is a Laravel application and its main Laravel ecosystems packag - laravel/pint (PINT) - v1 - pestphp/pest (PEST) - v3 - phpunit/phpunit (PHPUNIT) - v11 +- rector/rector (RECTOR) - v2 - @inertiajs/vue3 (INERTIA) - v2 - @laravel/vite-plugin-wayfinder (WAYFINDER) - v0 - tailwindcss (TAILWINDCSS) - v4 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b30f27a..3dfdfc2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -39,6 +39,9 @@ jobs: - name: Build Assets run: composer assets:build + - name: Run Rector + run: composer rector --dry-run + - name: Run Linter run: composer lint diff --git a/app/Http/Controllers/RegisterController.php b/app/Http/Controllers/RegisterController.php index ce788d8..d12ac85 100644 --- a/app/Http/Controllers/RegisterController.php +++ b/app/Http/Controllers/RegisterController.php @@ -34,6 +34,6 @@ public function store(RegisterStoreRequest $request) event(new Registered($user)); - return redirect()->route('home'); + return to_route('home'); } } diff --git a/app/Http/Controllers/ResetPasswordController.php b/app/Http/Controllers/ResetPasswordController.php index 3fab382..8454e30 100644 --- a/app/Http/Controllers/ResetPasswordController.php +++ b/app/Http/Controllers/ResetPasswordController.php @@ -31,7 +31,7 @@ public function store(ResetPasswordStoreRequest $request) session()->flash('success', __('passwords.sent')); - return redirect()->route('login'); + return to_route('login'); } public function edit(Request $request, string $token) @@ -60,6 +60,6 @@ public function update(ResetPasswordUpdateRequest $request) session()->flash('success', __('passwords.reset')); - return redirect()->route('login'); + return to_route('login'); } } diff --git a/app/Models/User.php b/app/Models/User.php index 598a746..3bc793a 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -56,7 +56,8 @@ protected function allPermissions(): Attribute ); } - protected function scopeHasRoles(Builder $query, array $roles): void + #[\Illuminate\Database\Eloquent\Attributes\Scope] + protected function hasRoles(Builder $query, array $roles): void { $query->whereHas('roles', fn (Builder $query) => $query->whereIn('name', $roles)); } diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 5150903..a1cd35a 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -21,7 +21,7 @@ class AppServiceProvider extends ServiceProvider { public function boot(): void { - URL::forceHttps(in_array(app()->environment(), [Environment::PRODUCTION, Environment::STAGING])); + URL::forceHttps(app()->environment([Environment::PRODUCTION->value, Environment::STAGING->value])); RequestException::dontTruncate(); diff --git a/composer.json b/composer.json index 316eb14..2c4ebfc 100644 --- a/composer.json +++ b/composer.json @@ -4,7 +4,7 @@ "description": "A starter project for Laravel apps using Inertia and Vue.", "license": "MIT", "require": { - "php": "^8.2", + "php": "^8.4", "filament/filament": "^4.0", "inertiajs/inertia-laravel": "^2.0", "laravel/framework": "^12.0", @@ -20,6 +20,7 @@ }, "require-dev": { "barryvdh/laravel-debugbar": "^3.13", + "driftingly/rector-laravel": "^2.1", "fakerphp/faker": "^1.23", "laravel/boost": "^1.8", "laravel/pint": "^1.17", @@ -28,6 +29,7 @@ "pestphp/pest": "^3.0", "pestphp/pest-plugin-faker": "^3.0", "pestphp/pest-plugin-laravel": "^3.0", + "rector/rector": "^2.2", "spatie/laravel-ray": "^1.37" }, "autoload": { @@ -58,6 +60,9 @@ "build:test": [ "composer install --no-interaction" ], + "rector": [ + "./vendor/bin/rector" + ], "lint": [ "./vendor/bin/pint --test" ], diff --git a/composer.lock b/composer.lock index 9853b49..1e273e0 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "caf6685e70a1d497c47bbb7b7119c54b", + "content-hash": "d70fba2179864b02ec42bbbed0e24750", "packages": [ { "name": "anourvalar/eloquent-serialize", @@ -5125,16 +5125,16 @@ }, { "name": "psy/psysh", - "version": "v0.12.15", + "version": "v0.12.16", "source": { "type": "git", "url": "https://github.com/bobthecow/psysh.git", - "reference": "38953bc71491c838fcb6ebcbdc41ab7483cd549c" + "reference": "ee6d5028be4774f56c6c2c85ec4e6bc9acfe6b67" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bobthecow/psysh/zipball/38953bc71491c838fcb6ebcbdc41ab7483cd549c", - "reference": "38953bc71491c838fcb6ebcbdc41ab7483cd549c", + "url": "https://api.github.com/repos/bobthecow/psysh/zipball/ee6d5028be4774f56c6c2c85ec4e6bc9acfe6b67", + "reference": "ee6d5028be4774f56c6c2c85ec4e6bc9acfe6b67", "shasum": "" }, "require": { @@ -5142,8 +5142,8 @@ "ext-tokenizer": "*", "nikic/php-parser": "^5.0 || ^4.0", "php": "^8.0 || ^7.4", - "symfony/console": "^7.0 || ^6.0 || ^5.0 || ^4.0 || ^3.4", - "symfony/var-dumper": "^7.0 || ^6.0 || ^5.0 || ^4.0 || ^3.4" + "symfony/console": "^8.0 || ^7.0 || ^6.0 || ^5.0 || ^4.0 || ^3.4", + "symfony/var-dumper": "^8.0 || ^7.0 || ^6.0 || ^5.0 || ^4.0 || ^3.4" }, "conflict": { "symfony/console": "4.4.37 || 5.3.14 || 5.3.15 || 5.4.3 || 5.4.4 || 6.0.3 || 6.0.4" @@ -5198,9 +5198,9 @@ ], "support": { "issues": "https://github.com/bobthecow/psysh/issues", - "source": "https://github.com/bobthecow/psysh/tree/v0.12.15" + "source": "https://github.com/bobthecow/psysh/tree/v0.12.16" }, - "time": "2025-11-28T00:00:14+00:00" + "time": "2025-12-07T03:39:01+00:00" }, { "name": "ralouphie/getallheaders", @@ -6333,16 +6333,16 @@ }, { "name": "symfony/console", - "version": "v7.4.0", + "version": "v7.4.1", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "0bc0f45254b99c58d45a8fbf9fb955d46cbd1bb8" + "reference": "6d9f0fbf2ec2e9785880096e3abd0ca0c88b506e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/0bc0f45254b99c58d45a8fbf9fb955d46cbd1bb8", - "reference": "0bc0f45254b99c58d45a8fbf9fb955d46cbd1bb8", + "url": "https://api.github.com/repos/symfony/console/zipball/6d9f0fbf2ec2e9785880096e3abd0ca0c88b506e", + "reference": "6d9f0fbf2ec2e9785880096e3abd0ca0c88b506e", "shasum": "" }, "require": { @@ -6407,7 +6407,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v7.4.0" + "source": "https://github.com/symfony/console/tree/v7.4.1" }, "funding": [ { @@ -6427,7 +6427,7 @@ "type": "tidelift" } ], - "time": "2025-11-27T13:27:24+00:00" + "time": "2025-12-05T15:23:39+00:00" }, { "name": "symfony/css-selector", @@ -6952,16 +6952,16 @@ }, { "name": "symfony/http-client", - "version": "v7.4.0", + "version": "v7.4.1", "source": { "type": "git", "url": "https://github.com/symfony/http-client.git", - "reference": "ee5e0e0139ab506f6063a230e631bed677c650a4" + "reference": "26cc224ea7103dda90e9694d9e139a389092d007" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client/zipball/ee5e0e0139ab506f6063a230e631bed677c650a4", - "reference": "ee5e0e0139ab506f6063a230e631bed677c650a4", + "url": "https://api.github.com/repos/symfony/http-client/zipball/26cc224ea7103dda90e9694d9e139a389092d007", + "reference": "26cc224ea7103dda90e9694d9e139a389092d007", "shasum": "" }, "require": { @@ -7029,7 +7029,7 @@ "http" ], "support": { - "source": "https://github.com/symfony/http-client/tree/v7.4.0" + "source": "https://github.com/symfony/http-client/tree/v7.4.1" }, "funding": [ { @@ -7049,7 +7049,7 @@ "type": "tidelift" } ], - "time": "2025-11-20T12:32:50+00:00" + "time": "2025-12-04T21:12:57+00:00" }, { "name": "symfony/http-client-contracts", @@ -7131,16 +7131,16 @@ }, { "name": "symfony/http-foundation", - "version": "v7.4.0", + "version": "v7.4.1", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "769c1720b68e964b13b58529c17d4a385c62167b" + "reference": "bd1af1e425811d6f077db240c3a588bdb405cd27" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/769c1720b68e964b13b58529c17d4a385c62167b", - "reference": "769c1720b68e964b13b58529c17d4a385c62167b", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/bd1af1e425811d6f077db240c3a588bdb405cd27", + "reference": "bd1af1e425811d6f077db240c3a588bdb405cd27", "shasum": "" }, "require": { @@ -7189,7 +7189,7 @@ "description": "Defines an object-oriented layer for the HTTP specification", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-foundation/tree/v7.4.0" + "source": "https://github.com/symfony/http-foundation/tree/v7.4.1" }, "funding": [ { @@ -7209,20 +7209,20 @@ "type": "tidelift" } ], - "time": "2025-11-13T08:49:24+00:00" + "time": "2025-12-07T11:13:10+00:00" }, { "name": "symfony/http-kernel", - "version": "v7.4.0", + "version": "v7.4.1", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "7348193cd384495a755554382e4526f27c456085" + "reference": "171d2ec4002012a023e042c6041d7fde58b143c6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/7348193cd384495a755554382e4526f27c456085", - "reference": "7348193cd384495a755554382e4526f27c456085", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/171d2ec4002012a023e042c6041d7fde58b143c6", + "reference": "171d2ec4002012a023e042c6041d7fde58b143c6", "shasum": "" }, "require": { @@ -7308,7 +7308,7 @@ "description": "Provides a structured process for converting a Request into a Response", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-kernel/tree/v7.4.0" + "source": "https://github.com/symfony/http-kernel/tree/v7.4.1" }, "funding": [ { @@ -7328,7 +7328,7 @@ "type": "tidelift" } ], - "time": "2025-11-27T13:38:24+00:00" + "time": "2025-12-07T16:28:51+00:00" }, { "name": "symfony/mailer", @@ -8645,16 +8645,16 @@ }, { "name": "symfony/string", - "version": "v8.0.0", + "version": "v8.0.1", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "f929eccf09531078c243df72398560e32fa4cf4f" + "reference": "ba65a969ac918ce0cc3edfac6cdde847eba231dc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/f929eccf09531078c243df72398560e32fa4cf4f", - "reference": "f929eccf09531078c243df72398560e32fa4cf4f", + "url": "https://api.github.com/repos/symfony/string/zipball/ba65a969ac918ce0cc3edfac6cdde847eba231dc", + "reference": "ba65a969ac918ce0cc3edfac6cdde847eba231dc", "shasum": "" }, "require": { @@ -8711,7 +8711,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v8.0.0" + "source": "https://github.com/symfony/string/tree/v8.0.1" }, "funding": [ { @@ -8731,20 +8731,20 @@ "type": "tidelift" } ], - "time": "2025-09-11T14:37:55+00:00" + "time": "2025-12-01T09:13:36+00:00" }, { "name": "symfony/translation", - "version": "v8.0.0", + "version": "v8.0.1", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "82ab368a6fca6358d995b6dd5c41590fb42c03e6" + "reference": "770e3b8b0ba8360958abedcabacd4203467333ca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/82ab368a6fca6358d995b6dd5c41590fb42c03e6", - "reference": "82ab368a6fca6358d995b6dd5c41590fb42c03e6", + "url": "https://api.github.com/repos/symfony/translation/zipball/770e3b8b0ba8360958abedcabacd4203467333ca", + "reference": "770e3b8b0ba8360958abedcabacd4203467333ca", "shasum": "" }, "require": { @@ -8804,7 +8804,7 @@ "description": "Provides tools to internationalize your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/translation/tree/v8.0.0" + "source": "https://github.com/symfony/translation/tree/v8.0.1" }, "funding": [ { @@ -8824,7 +8824,7 @@ "type": "tidelift" } ], - "time": "2025-11-27T08:09:45+00:00" + "time": "2025-12-01T09:13:36+00:00" }, { "name": "symfony/translation-contracts", @@ -9583,6 +9583,42 @@ }, "time": "2025-04-07T20:06:18+00:00" }, + { + "name": "driftingly/rector-laravel", + "version": "2.1.6", + "source": { + "type": "git", + "url": "https://github.com/driftingly/rector-laravel.git", + "reference": "682d1e73ac79aced7e645141fd61a9ac468a0c44" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/driftingly/rector-laravel/zipball/682d1e73ac79aced7e645141fd61a9ac468a0c44", + "reference": "682d1e73ac79aced7e645141fd61a9ac468a0c44", + "shasum": "" + }, + "require": { + "php": "^7.4 || ^8.0", + "rector/rector": "^2.2.7", + "webmozart/assert": "^1.11" + }, + "type": "rector-extension", + "autoload": { + "psr-4": { + "RectorLaravel\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Rector upgrades rules for Laravel Framework", + "support": { + "issues": "https://github.com/driftingly/rector-laravel/issues", + "source": "https://github.com/driftingly/rector-laravel/tree/2.1.6" + }, + "time": "2025-12-04T13:37:33+00:00" + }, { "name": "fakerphp/faker", "version": "v1.24.1", @@ -11355,6 +11391,59 @@ }, "time": "2025-11-21T15:09:14+00:00" }, + { + "name": "phpstan/phpstan", + "version": "2.1.33", + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/9e800e6bee7d5bd02784d4c6069b48032d16224f", + "reference": "9e800e6bee7d5bd02784d4c6069b48032d16224f", + "shasum": "" + }, + "require": { + "php": "^7.4|^8.0" + }, + "conflict": { + "phpstan/phpstan-shim": "*" + }, + "bin": [ + "phpstan", + "phpstan.phar" + ], + "type": "library", + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPStan - PHP Static Analysis Tool", + "keywords": [ + "dev", + "static analysis" + ], + "support": { + "docs": "https://phpstan.org/user-guide/getting-started", + "forum": "https://github.com/phpstan/phpstan/discussions", + "issues": "https://github.com/phpstan/phpstan/issues", + "security": "https://github.com/phpstan/phpstan/security/policy", + "source": "https://github.com/phpstan/phpstan-src" + }, + "funding": [ + { + "url": "https://github.com/ondrejmirtes", + "type": "github" + }, + { + "url": "https://github.com/phpstan", + "type": "github" + } + ], + "time": "2025-12-05T10:24:31+00:00" + }, { "name": "phpunit/php-code-coverage", "version": "11.0.11", @@ -11799,6 +11888,66 @@ ], "time": "2025-08-16T05:19:02+00:00" }, + { + "name": "rector/rector", + "version": "2.2.11", + "source": { + "type": "git", + "url": "https://github.com/rectorphp/rector.git", + "reference": "7bd21a40b0332b93d4bfee284093d7400696902d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/7bd21a40b0332b93d4bfee284093d7400696902d", + "reference": "7bd21a40b0332b93d4bfee284093d7400696902d", + "shasum": "" + }, + "require": { + "php": "^7.4|^8.0", + "phpstan/phpstan": "^2.1.32" + }, + "conflict": { + "rector/rector-doctrine": "*", + "rector/rector-downgrade-php": "*", + "rector/rector-phpunit": "*", + "rector/rector-symfony": "*" + }, + "suggest": { + "ext-dom": "To manipulate phpunit.xml via the custom-rule command" + }, + "bin": [ + "bin/rector" + ], + "type": "library", + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Instant Upgrade and Automated Refactoring of any PHP code", + "homepage": "https://getrector.com/", + "keywords": [ + "automation", + "dev", + "migration", + "refactoring" + ], + "support": { + "issues": "https://github.com/rectorphp/rector/issues", + "source": "https://github.com/rectorphp/rector/tree/2.2.11" + }, + "funding": [ + { + "url": "https://github.com/tomasvotruba", + "type": "github" + } + ], + "time": "2025-12-02T11:23:46+00:00" + }, { "name": "sebastian/cli-parser", "version": "3.0.2", @@ -13277,16 +13426,16 @@ }, { "name": "symfony/yaml", - "version": "v7.4.0", + "version": "v7.4.1", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "6c84a4b55aee4cd02034d1c528e83f69ddf63810" + "reference": "24dd4de28d2e3988b311751ac49e684d783e2345" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/6c84a4b55aee4cd02034d1c528e83f69ddf63810", - "reference": "6c84a4b55aee4cd02034d1c528e83f69ddf63810", + "url": "https://api.github.com/repos/symfony/yaml/zipball/24dd4de28d2e3988b311751ac49e684d783e2345", + "reference": "24dd4de28d2e3988b311751ac49e684d783e2345", "shasum": "" }, "require": { @@ -13329,7 +13478,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v7.4.0" + "source": "https://github.com/symfony/yaml/tree/v7.4.1" }, "funding": [ { @@ -13349,7 +13498,7 @@ "type": "tidelift" } ], - "time": "2025-11-16T10:14:42+00:00" + "time": "2025-12-04T18:11:45+00:00" }, { "name": "ta-tikoma/phpunit-architecture-test", @@ -13733,7 +13882,7 @@ "prefer-stable": true, "prefer-lowest": false, "platform": { - "php": "^8.2" + "php": "^8.4" }, "platform-dev": {}, "plugin-api-version": "2.9.0" diff --git a/database/migrations/0001_01_01_000007_create_permission_tables.php b/database/migrations/0001_01_01_000007_create_permission_tables.php index c8d8680..920ba05 100644 --- a/database/migrations/0001_01_01_000007_create_permission_tables.php +++ b/database/migrations/0001_01_01_000007_create_permission_tables.php @@ -19,12 +19,8 @@ public function up(): void $pivotRole = $columnNames['role_pivot_key'] ?? 'role_id'; $pivotPermission = $columnNames['permission_pivot_key'] ?? 'permission_id'; - if (empty($tableNames)) { - throw new \Exception('Error: config/permission.php not loaded. Run [php artisan config:clear] and try again.'); - } - if ($teams && empty($columnNames['team_foreign_key'] ?? null)) { - throw new \Exception('Error: team_foreign_key on config/permission.php not loaded. Run [php artisan config:clear] and try again.'); - } + throw_if(empty($tableNames), \Exception::class, 'Error: config/permission.php not loaded. Run [php artisan config:clear] and try again.'); + throw_if($teams && empty($columnNames['team_foreign_key'] ?? null), \Exception::class, 'Error: team_foreign_key on config/permission.php not loaded. Run [php artisan config:clear] and try again.'); Schema::create($tableNames['permissions'], function (Blueprint $table) { $table->bigIncrements('id'); // permission id @@ -115,7 +111,7 @@ public function up(): void $table->primary([$pivotPermission, $pivotRole], 'role_has_permissions_permission_id_role_id_primary'); }); - app('cache') + resolve('cache') ->store(config('permission.cache.store') != 'default' ? config('permission.cache.store') : null) ->forget(config('permission.cache.key')); } @@ -127,9 +123,7 @@ public function down(): void { $tableNames = config('permission.table_names'); - if (empty($tableNames)) { - throw new \Exception('Error: config/permission.php not found and defaults could not be merged. Please publish the package configuration before proceeding, or drop the tables manually.'); - } + throw_if(empty($tableNames), \Exception::class, 'Error: config/permission.php not found and defaults could not be merged. Please publish the package configuration before proceeding, or drop the tables manually.'); Schema::drop($tableNames['role_has_permissions']); Schema::drop($tableNames['model_has_roles']); diff --git a/rector.php b/rector.php new file mode 100644 index 0000000..a6e5e68 --- /dev/null +++ b/rector.php @@ -0,0 +1,38 @@ +withPaths([ + __DIR__.'/app', + __DIR__.'/bootstrap/app.php', + __DIR__.'/bootstrap/providers.php', + __DIR__.'/config', + __DIR__.'/lang', + __DIR__.'/database', + __DIR__.'/routes', + __DIR__.'/tests', + ]) + ->withPhpSets(php84: true)->withSets([ + LaravelLevelSetList::UP_TO_LARAVEL_120, + LaravelSetList::LARAVEL_CODE_QUALITY, + LaravelSetList::LARAVEL_COLLECTION, + LaravelSetList::LARAVEL_ARRAYACCESS_TO_METHOD_CALL, + LaravelSetList::LARAVEL_ARRAY_STR_FUNCTION_TO_STATIC_CALL, + LaravelSetList::LARAVEL_IF_HELPERS, + LaravelSetList::LARAVEL_TESTING, + LaravelSetList::LARAVEL_TYPE_DECLARATIONS, + ]) + ->withConfiguredRule(\RectorLaravel\Rector\FuncCall\RemoveDumpDataDeadCodeRector::class, [ + 'dd', 'dump', 'var_dump', 'ray', + ]) + ->withSkip([ + AddOverrideAttributeToOverriddenMethodsRector::class, + ChangeQueryWhereDateValueWithCarbonRector::class, + ]); diff --git a/routes/api.php b/routes/api.php index ccc387f..1e071cb 100644 --- a/routes/api.php +++ b/routes/api.php @@ -3,6 +3,4 @@ use Illuminate\Http\Request; use Illuminate\Support\Facades\Route; -Route::get('/user', function (Request $request) { - return $request->user(); -})->middleware('auth:sanctum'); +Route::get('/user', fn (Request $request) => $request->user())->middleware('auth:sanctum'); diff --git a/routes/web.php b/routes/web.php index d578af6..245d500 100644 --- a/routes/web.php +++ b/routes/web.php @@ -5,9 +5,7 @@ Route::get('health', Spatie\Health\Http\Controllers\HealthCheckResultsController::class)->middleware(['auth', 'role:'.Role::SUPER_ADMIN->value]); -Route::get('elements', function () { - return inertia('Elements'); -})->middleware(['auth', 'role:'.Role::SUPER_ADMIN->value])->name('elements'); +Route::get('elements', fn () => inertia('Elements'))->middleware(['auth', 'role:'.Role::SUPER_ADMIN->value])->name('elements'); Route::controller(App\Http\Controllers\RegisterController::class) ->middleware(['guest']) diff --git a/tests/Feature/Controllers/EmailVerificationControllerTest.php b/tests/Feature/Controllers/EmailVerificationControllerTest.php index f6956ab..b614f39 100644 --- a/tests/Feature/Controllers/EmailVerificationControllerTest.php +++ b/tests/Feature/Controllers/EmailVerificationControllerTest.php @@ -29,7 +29,7 @@ ->withoutMiddleware(Illuminate\Routing\Middleware\ValidateSignature::class) ->get(route('verification.verify', [ 'id' => $user->getKey(), - 'hash' => sha1($user->getEmailForVerification()), + 'hash' => sha1((string) $user->getEmailForVerification()), ])) ->assertSessionDoesntHaveErrors() ->assertRedirectToRoute('home'); diff --git a/tests/Pest.php b/tests/Pest.php index 8298932..970da46 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -38,9 +38,7 @@ | */ -expect()->extend('toBeOne', function () { - return $this->toBe(1); -}); +expect()->extend('toBeOne', fn () => $this->toBe(1)); /* |--------------------------------------------------------------------------