Skip to content

Commit a7094c2

Browse files
committed
formatting
1 parent ad13897 commit a7094c2

1 file changed

Lines changed: 12 additions & 28 deletions

File tree

src/Illuminate/Foundation/Console/PolicyMakeCommand.php

Lines changed: 12 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -37,48 +37,32 @@ class PolicyMakeCommand extends GeneratorCommand
3737
*/
3838
protected function buildClass($name)
3939
{
40-
$stub = parent::buildClass($name);
41-
42-
$stub = $this->replaceUserModelNamespace($stub);
40+
$stub = $this->replaceUserNamespace(
41+
parent::buildClass($name)
42+
);
4343

4444
$model = $this->option('model');
4545

4646
return $model ? $this->replaceModel($stub, $model) : $stub;
4747
}
4848

4949
/**
50-
* Replace the user model namespace for the given stub.
50+
* Replace the User model namespace.
5151
*
5252
* @param string $stub
5353
* @return string
5454
*/
55-
protected function replaceUserModelNamespace($stub)
55+
protected function replaceUserNamespace($stub)
5656
{
57-
if ($this->getDefaultUserNamespace() != $this->getRealUserNamespace()) {
58-
return str_replace($this->getDefaultUserNamespace(), $this->getRealUserNamespace(), $stub);
57+
if (! config('auth.providers.users.model')) {
58+
return $stub;
5959
}
6060

61-
return $stub;
62-
}
63-
64-
/**
65-
* Get the default namespace for the user model.
66-
*
67-
* @return string
68-
*/
69-
public function getDefaultUserNamespace()
70-
{
71-
return $this->rootNamespace().'User';
72-
}
73-
74-
/**
75-
* Get the real namespace for the user model.
76-
*
77-
* @return string
78-
*/
79-
public function getRealUserNamespace()
80-
{
81-
return config('auth.providers.users.model');
61+
return str_replace(
62+
$this->rootNamespace().'User',
63+
config('auth.providers.users.model'),
64+
$stub
65+
);
8266
}
8367

8468
/**

0 commit comments

Comments
 (0)