Skip to content

Commit

Permalink
allow array callback format with non-static methods
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Jun 18, 2020
1 parent 7594267 commit b7977d3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Illuminate/Auth/Access/Gate.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ public function has($ability)
*/
public function define($ability, $callback)
{
if (is_array($callback) && isset($callback[0]) && is_string($callback[0])) {
$callback = $callback[0].'@'.$callback[1];
}

if (is_callable($callback)) {
$this->abilities[$ability] = $callback;
} elseif (is_string($callback)) {
Expand Down

0 comments on commit b7977d3

Please sign in to comment.