Skip to content

Commit

Permalink
Merge tag 'v11.33.2'
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 Nov 20, 2024
2 parents 61e0148 + d899014 commit bbda102
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 20 deletions.
11 changes: 6 additions & 5 deletions Access/Gate.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,15 @@ class Gate implements GateContract
* @param callable|null $guessPolicyNamesUsingCallback
* @return void
*/
public function __construct(Container $container,
public function __construct(
Container $container,
callable $userResolver,
array $abilities = [],
array $policies = [],
array $beforeCallbacks = [],
array $afterCallbacks = [],
?callable $guessPolicyNamesUsingCallback = null)
{
?callable $guessPolicyNamesUsingCallback = null,
) {
$this->policies = $policies;
$this->container = $container;
$this->abilities = $abilities;
Expand Down Expand Up @@ -354,7 +355,7 @@ public function denies($ability, $arguments = [])
*/
public function check($abilities, $arguments = [])
{
return collect($abilities)->every(
return (new Collection($abilities))->every(
fn ($ability) => $this->inspect($ability, $arguments)->allowed()
);
}
Expand All @@ -368,7 +369,7 @@ public function check($abilities, $arguments = [])
*/
public function any($abilities, $arguments = [])
{
return collect($abilities)->contains(fn ($ability) => $this->check($ability, $arguments));
return (new Collection($abilities))->contains(fn ($ability) => $this->check($ability, $arguments));
}

/**
Expand Down
3 changes: 2 additions & 1 deletion Middleware/Authorize.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Closure;
use Illuminate\Contracts\Auth\Access\Gate;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Collection;

use function Illuminate\Support\enum_value;

Expand Down Expand Up @@ -72,7 +73,7 @@ protected function getGateArguments($request, $models)
return [];
}

return collect($models)->map(function ($model) use ($request) {
return (new Collection($models))->map(function ($model) use ($request) {
return $model instanceof Model ? $model : $this->getModel($request, $model);
})->all();
}
Expand Down
2 changes: 1 addition & 1 deletion Passwords/CacheTokenRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function create(CanResetPasswordContract $user)

$this->cache->put(
$this->prefix.$user->getEmailForPasswordReset(),
[$token, Carbon::now()->format($this->format)],
[$this->hasher->make($token), Carbon::now()->format($this->format)],
$this->expires,
);

Expand Down
12 changes: 8 additions & 4 deletions Passwords/DatabaseTokenRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,14 @@ class DatabaseTokenRepository implements TokenRepositoryInterface
* @param int $throttle
* @return void
*/
public function __construct(ConnectionInterface $connection, HasherContract $hasher,
$table, $hashKey, $expires = 60,
$throttle = 60)
{
public function __construct(
ConnectionInterface $connection,
HasherContract $hasher,
$table,
$hashKey,
$expires = 60,
$throttle = 60,
) {
$this->table = $table;
$this->hasher = $hasher;
$this->hashKey = $hashKey;
Expand Down
15 changes: 8 additions & 7 deletions SessionGuard.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,14 @@ class SessionGuard implements StatefulGuard, SupportsBasicAuth
* @param bool $rehashOnLogin
* @return void
*/
public function __construct($name,
UserProvider $provider,
Session $session,
?Request $request = null,
?Timebox $timebox = null,
bool $rehashOnLogin = true)
{
public function __construct(
$name,
UserProvider $provider,
Session $session,
?Request $request = null,
?Timebox $timebox = null,
bool $rehashOnLogin = true,
) {
$this->name = $name;
$this->session = $session;
$this->request = $request;
Expand Down
4 changes: 2 additions & 2 deletions TokenGuard.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ public function __construct(
Request $request,
$inputKey = 'api_token',
$storageKey = 'api_token',
$hash = false)
{
$hash = false,
) {
$this->hash = $hash;
$this->request = $request;
$this->provider = $provider;
Expand Down

0 comments on commit bbda102

Please sign in to comment.