Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Illuminate/Auth/Access/Gate.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,15 @@ public function __construct(
/**
* Determine if a given ability has been defined.
*
* @param string|array $ability
* @param string|\UnitEnum|array $ability
* @return bool
*/
public function has($ability)
{
$abilities = is_array($ability) ? $ability : func_get_args();

foreach ($abilities as $ability) {
if (! isset($this->abilities[$ability])) {
if (! isset($this->abilities[enum_value($ability)])) {
return false;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Contracts/Auth/Access/Gate.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ interface Gate
/**
* Determine if a given ability has been defined.
*
* @param string $ability
* @param \UnitEnum|string $ability
* @return bool
*/
public function has($ability);
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Support/Facades/Gate.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Illuminate\Contracts\Auth\Access\Gate as GateContract;

/**
* @method static bool has(string|array $ability)
* @method static bool has(\UnitEnum|string|array $ability)
* @method static \Illuminate\Auth\Access\Response allowIf(\Illuminate\Auth\Access\Response|\Closure|bool $condition, string|null $message = null, string|null $code = null)
* @method static \Illuminate\Auth\Access\Response denyIf(\Illuminate\Auth\Access\Response|\Closure|bool $condition, string|null $message = null, string|null $code = null)
* @method static \Illuminate\Auth\Access\Gate define(\UnitEnum|string $ability, callable|array|string $callback)
Expand Down