diff --git a/src/Illuminate/Foundation/Console/EnumMakeCommand.php b/src/Illuminate/Foundation/Console/EnumMakeCommand.php new file mode 100644 index 000000000000..7c3273521f3c --- /dev/null +++ b/src/Illuminate/Foundation/Console/EnumMakeCommand.php @@ -0,0 +1,77 @@ +argument('name')); + + $name = str_replace(['\\', '.'], '/', $this->argument('name')); + + return $name; + } + + /** + * Get the stub file for the generator. + * + * @return string + */ + protected function getStub() + { + return $this->resolveStubPath( + '/stubs/enum.stub', + ); + } + + /** + * Get the default namespace for the generator. + * + * @return string + */ + protected function getDefaultNamespace($rootNamespace) + { + return $rootNamespace.'\Enums'; + } + + protected function replaceClass($stub, $name) + { + $class = str_replace($this->getNamespace($name).'\\', '', $name); + + return str_replace('{{enum_name}}', $class, $stub); + } +} diff --git a/src/Illuminate/Foundation/Console/stubs/enum.stub b/src/Illuminate/Foundation/Console/stubs/enum.stub new file mode 100644 index 000000000000..e81be39003aa --- /dev/null +++ b/src/Illuminate/Foundation/Console/stubs/enum.stub @@ -0,0 +1,8 @@ +