- laravel framework upgrade frpm 7.x to 8. see also: https://laravel.com/docs/8.x/upgrade#assert-exact-json-method

- use  PHP7 null coalesce operator instead of laravel optional method
- change Breadcrumbs::register method to Bredcrumbs::for method
- composer updates
This commit is contained in:
Arno Kaimbacher 2022-08-10 11:18:10 +02:00
parent 1b2e77d907
commit 8ea540a88c
50 changed files with 616 additions and 263 deletions

View file

@ -2,7 +2,7 @@
namespace App\Providers;
use Illuminate\Support\Facades\Gate;
// use Illuminate\Support\Facades\Gate;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
class AuthServiceProvider extends ServiceProvider

View file

@ -3,19 +3,30 @@ namespace App\Providers;
use Illuminate\Support\Facades\Route;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Http\Request;
use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Support\Facades\RateLimiter;
class RouteServiceProvider extends ServiceProvider
{
/**
* The path to the "home" route for your application.
*
* This is used by Laravel authentication to redirect users after login.
*
* @var string
*/
public const HOME = '/settings';
/**
* This namespace is applied to the controller routes in your routes file.
* If specified, this namespace is automatically applied to your controller routes.
*
* In addition, it is set as the URL generator's root namespace.
*
* @var string
*/
protected $namespace = 'App\Http\Controllers';
public const HOME = '/settings';
/**
* Define your route model bindings, pattern filters, etc.
@ -25,7 +36,19 @@ class RouteServiceProvider extends ServiceProvider
*/
public function boot()
{
parent::boot();
// parent::boot();
$this->configureRateLimiting();
$this->routes(function () {
// Route::prefix('api')
Route::middleware('api')
->namespace($this->namespace)
->group(base_path('routes/api.php'));
Route::middleware('web')
->namespace($this->namespace)
->group(base_path('routes/web.php'));
});
//
}
@ -73,4 +96,17 @@ class RouteServiceProvider extends ServiceProvider
->namespace($this->namespace)
->group(base_path('routes/api.php'));
}
/**
* Configure the rate limiters for the application.
*
* @return void
*/
protected function configureRateLimiting()
{
RateLimiter::for('api', function (Request $request) {
return Limit::perMinute(60)->by(optional($request->user())->id ?: $request->ip());
});
}
}