@@ -36,6 +36,7 @@ class RepositoryCommand extends GeneratorCommand
3636 * Execute the console command.
3737 *
3838 * @return bool|null
39+ * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
3940 */
4041 public function handle ()
4142 {
@@ -47,6 +48,7 @@ public function handle()
4748 *
4849 * @param string $name
4950 * @return string
51+ * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
5052 */
5153 protected function buildClass ($ name )
5254 {
@@ -60,6 +62,19 @@ protected function buildClass($name)
6062 $ model = $ this ->laravel ->getNamespace ().$ model ;
6163 }
6264
65+ if ($ this ->option ('all ' )) {
66+ $ this ->call ('make:model ' , [
67+ 'name ' => $ this ->argument ('name ' ),
68+ '--factory ' => true ,
69+ '--migration ' => true ,
70+ '--controller ' => true ,
71+ ]);
72+
73+ $ this ->call ('make:policy ' , [
74+ 'name ' => $ this ->argument ('name ' ).'Policy ' ,
75+ ]);
76+ }
77+
6378 return str_replace (
6479 'DummyFullModel ' , $ model , parent ::buildClass ($ name )
6580 );
@@ -94,6 +109,7 @@ protected function getDefaultNamespace($rootNamespace)
94109 protected function getOptions ()
95110 {
96111 return [
112+ ['all ' , 'a ' , InputOption::VALUE_NONE , 'Generate a migration, factory, and controller for the repository ' ],
97113 ['model ' , 'm ' , InputOption::VALUE_REQUIRED , 'The model class being represented. ' ],
98114 ];
99115 }
0 commit comments