Upgrade to Laravel 10

This commit is contained in:
Jonny Barnes 2023-02-18 09:34:57 +00:00
parent c4d7dc31d5
commit 16b120bc73
Signed by: jonny
SSH key fingerprint: SHA256:CTuSlns5U7qlD9jqHvtnVmfYV3Zwl2Z7WnJ4/dqOaL8
142 changed files with 1676 additions and 2019 deletions

View file

@ -25,10 +25,8 @@ class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
public function boot(): void
{
Note::observe(NoteObserver::class);
@ -144,10 +142,8 @@ class AppServiceProvider extends ServiceProvider
/**
* Register any application services.
*
* @return void
*/
public function register()
public function register(): void
{
if ($this->app->environment('local', 'testing')) {
$this->app->register(DuskServiceProvider::class);

View file

@ -7,16 +7,16 @@ use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvid
class AuthServiceProvider extends ServiceProvider
{
/**
* The policy mappings for the application.
* The model to policy mappings for the application.
*
* @var array
* @var array<class-string, class-string>
*/
protected $policies = [
// 'App\Models\Model' => 'App\Policies\ModelPolicy',
];
/**
* Register any application authentication / authorization services.
* Register any authentication / authorization services.
*/
public function boot(): void
{

View file

@ -12,10 +12,8 @@ class BroadcastServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
public function boot(): void
{
Broadcast::routes();

View file

@ -10,9 +10,9 @@ use Illuminate\Support\Facades\Event;
class EventServiceProvider extends ServiceProvider
{
/**
* The event listener mappings for the application.
* The event to listener mappings for the application.
*
* @var array
* @var array<class-string, array<int, class-string>>
*/
protected $listen = [
Registered::class => [
@ -22,13 +22,9 @@ class EventServiceProvider extends ServiceProvider
/**
* Register any events for your application.
*
* @return void
*/
public function boot()
public function boot(): void
{
parent::boot();
//
}
}

View file

@ -10,10 +10,8 @@ class HorizonServiceProvider extends HorizonApplicationServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
public function boot(): void
{
parent::boot();
@ -28,10 +26,8 @@ class HorizonServiceProvider extends HorizonApplicationServiceProvider
* Register the Horizon gate.
*
* This gate determines who can access Horizon in non-local environments.
*
* @return void
*/
protected function gate()
protected function gate(): void
{
Gate::define('viewHorizon', function ($user) {
return $user->name === 'jonny';

View file

@ -11,46 +11,38 @@ use Illuminate\Support\Facades\Route;
class RouteServiceProvider extends ServiceProvider
{
/**
* This namespace is applied to your controller routes.
* The path to the "home" route for your application.
*
* In addition, it is set as the URL generator's root namespace.
* Typically, users are redirected here after authentication.
*
* @var string|null
* @var string
*/
// protected $namespace = 'App\Http\Controllers';
public const HOME = '/admin';
/**
* Define your route model bindings, pattern filters, etc.
*
* @return void
* Define your route model bindings, pattern filters, and other route configuration.
*/
public function boot()
public function boot(): void
{
$this->configureRateLimiting();
$this->routes(function () {
Route::prefix('api')
->middleware('api')
->namespace($this->namespace)
Route::middleware('api')
->prefix('api')
->group(base_path('routes/api.php'));
Route::middleware('web')
->namespace($this->namespace)
->group(base_path('routes/web.php'));
});
}
/**
* Configure the rate limiters for the application.
*
* @return void
*
* @codeCoverageIgnore
*/
protected function configureRateLimiting()
protected function configureRateLimiting(): void
{
RateLimiter::for('api', function (Request $request) {
return Limit::perMinute(60);
return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip());
});
}
}