Skip to content

Commit

Permalink
Apply fixes from StyleCI (#662)
Browse files Browse the repository at this point in the history
Co-authored-by: StyleCI Bot <[email protected]>
  • Loading branch information
santigarcor and StyleCIBot authored Jan 18, 2024
1 parent 79a4154 commit c95c520
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/Middleware/LaratrustMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ protected function authorization(
$method = $type == 'roles' ? 'hasRole' : 'hasPermission';
$rolesPermissions = Helper::standardize($rolesPermissions, true);

return !Auth::guard($guard)->guest()
return ! Auth::guard($guard)->guest()
&& Auth::guard($guard)->user()->$method($rolesPermissions, $team, $requireAll);
}

Expand All @@ -50,7 +50,7 @@ protected function unauthorized(): mixed
}

$redirect = Redirect::to($handler['url']);
if (!empty($handler['message']['content'])) {
if (! empty($handler['message']['content'])) {
$redirect->with($handler['message']['key'], $handler['message']['content']);
}

Expand All @@ -63,12 +63,12 @@ protected function unauthorized(): mixed
protected function getValuesFromParameters(?string $team, ?string $options): array
{
return [
'team' => Str::contains((string)$team, ['require_all', 'guard:']) ? null : $team,
'require_all' => Str::contains((string)$team, 'require_all') ?: Str::contains((string)$options, 'require_all'),
'guard' => Str::contains((string)$team, 'guard:')
'team' => Str::contains((string) $team, ['require_all', 'guard:']) ? null : $team,
'require_all' => Str::contains((string) $team, 'require_all') ?: Str::contains((string) $options, 'require_all'),
'guard' => Str::contains((string) $team, 'guard:')
? $this->extractGuard($team)
: (
Str::contains((string)$options, 'guard:')
Str::contains((string) $options, 'guard:')
? $this->extractGuard($options)
: Config::get('auth.defaults.guard')
),
Expand All @@ -83,7 +83,7 @@ protected function extractGuard(string $string): string
$options = Collection::make(explode('|', $string));

return $options
->reject(fn ($option) => !Str::contains($option, 'guard:'))
->reject(fn ($option) => ! Str::contains($option, 'guard:'))
->map(fn ($option) => Str::of($option)->explode(':')->get(1))
->first();
}
Expand Down

0 comments on commit c95c520

Please sign in to comment.