Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[develop] Adds L11 support #257

Merged
merged 12 commits into from
Dec 28, 2023
6 changes: 5 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
12 changes: 12 additions & 0 deletions src/Auth/stubs/controllers/Controller.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace {{namespace}}Http\Controllers;

use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;

class Controller extends BaseController
{
use AuthorizesRequests, ValidatesRequests;
}
33 changes: 23 additions & 10 deletions src/AuthCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,35 +117,48 @@ protected function exportBackend()

if (file_exists($controller) && ! $this->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(
base_path('routes/web.php'),
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')
);
}

Expand Down
3 changes: 1 addition & 2 deletions stubs/Auth/ConfirmPasswordController.stub
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -26,7 +25,7 @@ class ConfirmPasswordController extends Controller
*
* @var string
*/
protected $redirectTo = RouteServiceProvider::HOME;
protected $redirectTo = '/home';

/**
* Create a new controller instance.
Expand Down
3 changes: 1 addition & 2 deletions stubs/Auth/LoginController.stub
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -26,7 +25,7 @@ class LoginController extends Controller
*
* @var string
*/
protected $redirectTo = RouteServiceProvider::HOME;
protected $redirectTo = '/home';

/**
* Create a new controller instance.
Expand Down
3 changes: 1 addition & 2 deletions stubs/Auth/RegisterController.stub
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -29,7 +28,7 @@ class RegisterController extends Controller
*
* @var string
*/
protected $redirectTo = RouteServiceProvider::HOME;
protected $redirectTo = '/home';

/**
* Create a new controller instance.
Expand Down
3 changes: 1 addition & 2 deletions stubs/Auth/ResetPasswordController.stub
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -26,5 +25,5 @@ class ResetPasswordController extends Controller
*
* @var string
*/
protected $redirectTo = RouteServiceProvider::HOME;
protected $redirectTo = '/home';
}
3 changes: 1 addition & 2 deletions stubs/Auth/VerificationController.stub
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -26,7 +25,7 @@ class VerificationController extends Controller
*
* @var string
*/
protected $redirectTo = RouteServiceProvider::HOME;
protected $redirectTo = '/home';

/**
* Create a new controller instance.
Expand Down
2 changes: 1 addition & 1 deletion tests/AuthBackend/ThrottleLoginsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' => ['ⓣⓔⓢⓣ@ⓛⓐⓡⓐⓥⓔⓛ.ⓒⓞⓜ', '[email protected]'],
Expand Down