diff --git a/src/Illuminate/Console/GeneratorCommand.php b/src/Illuminate/Console/GeneratorCommand.php index 07913bd67eac..798a9dc5e137 100644 --- a/src/Illuminate/Console/GeneratorCommand.php +++ b/src/Illuminate/Console/GeneratorCommand.php @@ -417,13 +417,7 @@ protected function sortImports($stub) */ protected function getNameInput() { - $name = trim($this->argument('name')); - - if (Str::endsWith($name, '.php')) { - return Str::substr($name, 0, -4); - } - - return $name; + return (string) Str::of($this->argument('name'))->trim()->beforeLast('.php'); } /**