Skip to content

Commit

Permalink
Merge tag 'v11.35.0'
Browse files Browse the repository at this point in the history
Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
  • Loading branch information
crynobone committed Dec 10, 2024
2 parents 8b8d4c6 + bb4d6f6 commit 4ce3658
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
12 changes: 7 additions & 5 deletions Access/Gate.php
Original file line number Diff line number Diff line change
Expand Up @@ -836,12 +836,14 @@ protected function formatAbilityToMethod($ability)
*/
public function forUser($user)
{
$callback = fn () => $user;

return new static(
$this->container, $callback, $this->abilities,
$this->policies, $this->beforeCallbacks, $this->afterCallbacks,
$this->guessPolicyNamesUsingCallback
$this->container,
fn () => $user,
$this->abilities,
$this->policies,
$this->beforeCallbacks,
$this->afterCallbacks,
$this->guessPolicyNamesUsingCallback,
);
}

Expand Down
4 changes: 1 addition & 3 deletions AuthManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,9 @@ protected function callCustomCreator($name, array $config)
*/
public function createSessionDriver($name, $config)
{
$provider = $this->createUserProvider($config['provider'] ?? null);

$guard = new SessionGuard(
$name,
$provider,
$this->createUserProvider($config['provider'] ?? null),
$this->app['session.store'],
rehashOnLogin: $this->app['config']->get('hashing.rehash_on_login', true),
);
Expand Down
8 changes: 5 additions & 3 deletions CreatesUserProviders.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,11 @@ protected function getProviderConfiguration($provider)
*/
protected function createDatabaseProvider($config)
{
$connection = $this->app['db']->connection($config['connection'] ?? null);

return new DatabaseUserProvider($connection, $this->app['hash'], $config['table']);
return new DatabaseUserProvider(
$this->app['db']->connection($config['connection'] ?? null),
$this->app['hash'],
$config['table'],
);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions Middleware/Authorize.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ protected function getGateArguments($request, $models)
return [];
}

return (new Collection($models))->map(function ($model) use ($request) {
return $model instanceof Model ? $model : $this->getModel($request, $model);
})->all();
return (new Collection($models))
->map(fn ($model) => $model instanceof Model ? $model : $this->getModel($request, $model))
->all();
}

/**
Expand Down

0 comments on commit 4ce3658

Please sign in to comment.