Convert optional()
to nullsafe operator
This commit is contained in:
parent
df257ead7a
commit
a9d76b1cfd
1 changed files with 2 additions and 2 deletions
|
@ -57,10 +57,10 @@ 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());
|
||||
});
|
||||
RateLimiter::for('web', function (Request $request) {
|
||||
return Limit::perMinute(40)->by(optional($request->user())->id ?: $request->ip());
|
||||
return Limit::perMinute(40)->by($request->user()?->id ?: $request->ip());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue