mirror of
https://github.com/laravel/laravel.git
synced 2025-02-20 11:53:14 +08:00
[9.x] Use php 8 null safe operator (#5670)
This PR leverages php 8 "null safe operator" instead of thrr `optional()` helper
This commit is contained in:
parent
d57cc57c6d
commit
5f9dbb41b5
@ -57,7 +57,7 @@ class RouteServiceProvider extends ServiceProvider
|
||||
protected function configureRateLimiting()
|
||||
{
|
||||
RateLimiter::for('api', function (Request $request) {
|
||||
return Limit::perMinute(60)->by(optional($request->user())->id ?: $request->ip());
|
||||
return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user