diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 95a91db..924163e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -17,10 +17,14 @@ jobs: fail-fast: true matrix: php: ['8.0', 8.1, 8.2, 8.3] - laravel: [9, 10] + laravel: [9, 10, 11] exclude: - php: '8.0' laravel: 10 + - php: '8.0' + laravel: 11 + - php: '8.1' + laravel: 11 - php: 8.3 laravel: 9 diff --git a/README.md b/README.md index 3ccf8fe..ed28d3d 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ Only the latest major version of Laravel UI receives bug fixes. The table below | [1.x](https://github.com/laravel/ui/tree/1.x) | 5.8, 6.x | | [2.x](https://github.com/laravel/ui/tree/2.x) | 7.x | | [3.x](https://github.com/laravel/ui/tree/3.x) | 8.x | -| [4.x](https://github.com/laravel/ui/tree/4.x) | 9.x, 10.x | +| [4.x](https://github.com/laravel/ui/tree/4.x) | 9.x, 10.x, 11.x | ### Installation diff --git a/composer.json b/composer.json index 55db8e1..928acc8 100644 --- a/composer.json +++ b/composer.json @@ -11,14 +11,14 @@ ], "require": { "php": "^8.0", - "illuminate/console": "^9.21|^10.0", - "illuminate/filesystem": "^9.21|^10.0", - "illuminate/support": "^9.21|^10.0", - "illuminate/validation": "^9.21|^10.0" + "illuminate/console": "^9.21|^10.0|^11.0", + "illuminate/filesystem": "^9.21|^10.0|^11.0", + "illuminate/support": "^9.21|^10.0|^11.0", + "illuminate/validation": "^9.21|^10.0|^11.0" }, "require-dev": { - "orchestra/testbench": "^7.0|^8.0", - "phpunit/phpunit": "^9.3" + "orchestra/testbench": "^7.0|^8.0|^9.0", + "phpunit/phpunit": "^9.3|^10.4" }, "autoload": { "psr-4": { diff --git a/src/Auth/stubs/controllers/Controller.stub b/src/Auth/stubs/controllers/Controller.stub new file mode 100644 index 0000000..8fa10da --- /dev/null +++ b/src/Auth/stubs/controllers/Controller.stub @@ -0,0 +1,12 @@ +option('force')) { if ($this->components->confirm("The [HomeController.php] file already exists. Do you want to replace it?")) { - file_put_contents($controller, $this->compileControllerStub()); + file_put_contents($controller, $this->compileStub('controllers/HomeController')); } } else { - file_put_contents($controller, $this->compileControllerStub()); + file_put_contents($controller, $this->compileStub('controllers/HomeController')); + } + + $baseController = app_path('Http/Controllers/Controller.php'); + + if (file_exists($baseController) && ! $this->option('force')) { + if ($this->components->confirm("The [Controller.php] file already exists. Do you want to replace it?")) { + file_put_contents($baseController, $this->compileStub('controllers/Controller')); + } + } else { + file_put_contents($baseController, $this->compileStub('controllers/Controller')); + } + + if (! file_exists(database_path('migrations/0001_01_01_000000_create_users_table.php'))) { + copy( + __DIR__.'/../stubs/migrations/2014_10_12_100000_create_password_resets_table.php', + base_path('database/migrations/2014_10_12_100000_create_password_resets_table.php') + ); } file_put_contents( @@ -128,24 +145,20 @@ protected function exportBackend() file_get_contents(__DIR__.'/Auth/stubs/routes.stub'), FILE_APPEND ); - - copy( - __DIR__.'/../stubs/migrations/2014_10_12_100000_create_password_resets_table.php', - base_path('database/migrations/2014_10_12_100000_create_password_resets_table.php') - ); } /** - * Compiles the "HomeController" stub. + * Compiles the given stub. * + * @param string $stub * @return string */ - protected function compileControllerStub() + protected function compileStub($stub) { return str_replace( '{{namespace}}', $this->laravel->getNamespace(), - file_get_contents(__DIR__.'/Auth/stubs/controllers/HomeController.stub') + file_get_contents(__DIR__.'/Auth/stubs/'.$stub.'.stub') ); } diff --git a/stubs/Auth/ConfirmPasswordController.stub b/stubs/Auth/ConfirmPasswordController.stub index 138c1f0..3559954 100644 --- a/stubs/Auth/ConfirmPasswordController.stub +++ b/stubs/Auth/ConfirmPasswordController.stub @@ -3,7 +3,6 @@ namespace App\Http\Controllers\Auth; use App\Http\Controllers\Controller; -use App\Providers\RouteServiceProvider; use Illuminate\Foundation\Auth\ConfirmsPasswords; class ConfirmPasswordController extends Controller @@ -26,7 +25,7 @@ class ConfirmPasswordController extends Controller * * @var string */ - protected $redirectTo = RouteServiceProvider::HOME; + protected $redirectTo = '/home'; /** * Create a new controller instance. diff --git a/stubs/Auth/LoginController.stub b/stubs/Auth/LoginController.stub index 18a0d08..b2ea669 100644 --- a/stubs/Auth/LoginController.stub +++ b/stubs/Auth/LoginController.stub @@ -3,7 +3,6 @@ namespace App\Http\Controllers\Auth; use App\Http\Controllers\Controller; -use App\Providers\RouteServiceProvider; use Illuminate\Foundation\Auth\AuthenticatesUsers; class LoginController extends Controller @@ -26,7 +25,7 @@ class LoginController extends Controller * * @var string */ - protected $redirectTo = RouteServiceProvider::HOME; + protected $redirectTo = '/home'; /** * Create a new controller instance. diff --git a/stubs/Auth/RegisterController.stub b/stubs/Auth/RegisterController.stub index ed1a5e0..961ea36 100644 --- a/stubs/Auth/RegisterController.stub +++ b/stubs/Auth/RegisterController.stub @@ -3,7 +3,6 @@ namespace App\Http\Controllers\Auth; use App\Http\Controllers\Controller; -use App\Providers\RouteServiceProvider; use App\Models\User; use Illuminate\Foundation\Auth\RegistersUsers; use Illuminate\Support\Facades\Hash; @@ -29,7 +28,7 @@ class RegisterController extends Controller * * @var string */ - protected $redirectTo = RouteServiceProvider::HOME; + protected $redirectTo = '/home'; /** * Create a new controller instance. diff --git a/stubs/Auth/ResetPasswordController.stub b/stubs/Auth/ResetPasswordController.stub index b1726a3..fe965b2 100644 --- a/stubs/Auth/ResetPasswordController.stub +++ b/stubs/Auth/ResetPasswordController.stub @@ -3,7 +3,6 @@ namespace App\Http\Controllers\Auth; use App\Http\Controllers\Controller; -use App\Providers\RouteServiceProvider; use Illuminate\Foundation\Auth\ResetsPasswords; class ResetPasswordController extends Controller @@ -26,5 +25,5 @@ class ResetPasswordController extends Controller * * @var string */ - protected $redirectTo = RouteServiceProvider::HOME; + protected $redirectTo = '/home'; } diff --git a/stubs/Auth/VerificationController.stub b/stubs/Auth/VerificationController.stub index 5e749af..23a43a8 100644 --- a/stubs/Auth/VerificationController.stub +++ b/stubs/Auth/VerificationController.stub @@ -3,7 +3,6 @@ namespace App\Http\Controllers\Auth; use App\Http\Controllers\Controller; -use App\Providers\RouteServiceProvider; use Illuminate\Foundation\Auth\VerifiesEmails; class VerificationController extends Controller @@ -26,7 +25,7 @@ class VerificationController extends Controller * * @var string */ - protected $redirectTo = RouteServiceProvider::HOME; + protected $redirectTo = '/home'; /** * Create a new controller instance. diff --git a/tests/AuthBackend/ThrottleLoginsTest.php b/tests/AuthBackend/ThrottleLoginsTest.php index 026dc89..b2c2c3d 100644 --- a/tests/AuthBackend/ThrottleLoginsTest.php +++ b/tests/AuthBackend/ThrottleLoginsTest.php @@ -28,7 +28,7 @@ public function it_can_generate_throttle_key(string $email, string $expectedEmai $this->assertSame($expectedEmail . '|192.168.0.1', $method->invoke($throttle, $request)); } - public function emailProvider(): array + public static function emailProvider(): array { return [ 'lowercase special characters' => ['ⓣⓔⓢⓣ@ⓛⓐⓡⓐⓥⓔⓛ.ⓒⓞⓜ', 'test@laravel.com'],