From a7094c2e68a6eb9768462ce9b8d26fec00e9ba65 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Mon, 10 Jul 2017 08:16:20 -0500 Subject: [PATCH] formatting --- .../Foundation/Console/PolicyMakeCommand.php | 40 ++++++------------- 1 file changed, 12 insertions(+), 28 deletions(-) diff --git a/src/Illuminate/Foundation/Console/PolicyMakeCommand.php b/src/Illuminate/Foundation/Console/PolicyMakeCommand.php index 87f59206256d..3dbf950fe2cb 100644 --- a/src/Illuminate/Foundation/Console/PolicyMakeCommand.php +++ b/src/Illuminate/Foundation/Console/PolicyMakeCommand.php @@ -37,9 +37,9 @@ class PolicyMakeCommand extends GeneratorCommand */ protected function buildClass($name) { - $stub = parent::buildClass($name); - - $stub = $this->replaceUserModelNamespace($stub); + $stub = $this->replaceUserNamespace( + parent::buildClass($name) + ); $model = $this->option('model'); @@ -47,38 +47,22 @@ protected function buildClass($name) } /** - * Replace the user model namespace for the given stub. + * Replace the User model namespace. * * @param string $stub * @return string */ - protected function replaceUserModelNamespace($stub) + protected function replaceUserNamespace($stub) { - if ($this->getDefaultUserNamespace() != $this->getRealUserNamespace()) { - return str_replace($this->getDefaultUserNamespace(), $this->getRealUserNamespace(), $stub); + if (! config('auth.providers.users.model')) { + return $stub; } - return $stub; - } - - /** - * Get the default namespace for the user model. - * - * @return string - */ - public function getDefaultUserNamespace() - { - return $this->rootNamespace().'User'; - } - - /** - * Get the real namespace for the user model. - * - * @return string - */ - public function getRealUserNamespace() - { - return config('auth.providers.users.model'); + return str_replace( + $this->rootNamespace().'User', + config('auth.providers.users.model'), + $stub + ); } /**