diff --git a/src/Illuminate/Auth/Access/Gate.php b/src/Illuminate/Auth/Access/Gate.php index 55a764c4ae5a..3a80ca6b14b7 100644 --- a/src/Illuminate/Auth/Access/Gate.php +++ b/src/Illuminate/Auth/Access/Gate.php @@ -80,10 +80,12 @@ class Gate implements GateContract * @param array $policies * @param array $beforeCallbacks * @param array $afterCallbacks + * @param callable $guessPolicyNamesUsingCallback * @return void */ public function __construct(Container $container, callable $userResolver, array $abilities = [], - array $policies = [], array $beforeCallbacks = [], array $afterCallbacks = []) + array $policies = [], array $beforeCallbacks = [], array $afterCallbacks = [], + callable $guessPolicyNamesUsingCallback = null) { $this->policies = $policies; $this->container = $container; @@ -91,6 +93,7 @@ public function __construct(Container $container, callable $userResolver, array $this->userResolver = $userResolver; $this->afterCallbacks = $afterCallbacks; $this->beforeCallbacks = $beforeCallbacks; + $this->guessPolicyNamesUsingCallback = $guessPolicyNamesUsingCallback; } /** @@ -700,7 +703,8 @@ public function forUser($user) return new static( $this->container, $callback, $this->abilities, - $this->policies, $this->beforeCallbacks, $this->afterCallbacks + $this->policies, $this->beforeCallbacks, $this->afterCallbacks, + $this->guessPolicyNamesUsingCallback ); }