From edd383b4897fce537729081749e6c7774069214c Mon Sep 17 00:00:00 2001 From: Erik Gaal Date: Thu, 28 Feb 2019 09:40:02 +0100 Subject: [PATCH 1/2] Make Gate::forUser pass the policy guesser to the constructor --- src/Illuminate/Auth/Access/Gate.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Auth/Access/Gate.php b/src/Illuminate/Auth/Access/Gate.php index 55a764c4ae5a..cd3a6f974dd9 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,7 @@ 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 ); } From ed91b7ddaedcde80dcfda261d8f125fd1ee19c4f Mon Sep 17 00:00:00 2001 From: Erik Gaal Date: Thu, 28 Feb 2019 09:51:19 +0100 Subject: [PATCH 2/2] Push 7th argument to new line --- src/Illuminate/Auth/Access/Gate.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Auth/Access/Gate.php b/src/Illuminate/Auth/Access/Gate.php index cd3a6f974dd9..3a80ca6b14b7 100644 --- a/src/Illuminate/Auth/Access/Gate.php +++ b/src/Illuminate/Auth/Access/Gate.php @@ -703,7 +703,8 @@ public function forUser($user) return new static( $this->container, $callback, $this->abilities, - $this->policies, $this->beforeCallbacks, $this->afterCallbacks, $this->guessPolicyNamesUsingCallback + $this->policies, $this->beforeCallbacks, $this->afterCallbacks, + $this->guessPolicyNamesUsingCallback ); }