@@ -31,19 +31,20 @@ public function handle()
3131 $ modelName = $ this ->option ('model ' );
3232 if (empty ($ modelName ) || !class_exists ($ modelName )) {
3333 $ this ->error ('Model does not exists ! ' );
34+
3435 return false ;
3536 }
3637
3738 // use doctrine/dbal
3839 $ model = $ this ->laravel ->make ($ modelName );
39- $ table = $ model ->getConnection ()->getTablePrefix () . $ model ->getTable ();
40+ $ table = $ model ->getConnection ()->getTablePrefix (). $ model ->getTable ();
4041 $ schema = $ model ->getConnection ()->getDoctrineSchemaManager ($ table );
4142
4243 if (!method_exists ($ schema , 'getDatabasePlatform ' )) {
4344 $ this ->error ('You need to require doctrine/dbal: ~2.3 in your own composer.json to get database columns. ' );
4445 $ this ->info ('Using install command: composer require doctrine/dbal ' );
45- return false ;
4646
47+ return false ;
4748 }
4849
4950 // custom mapping the types that doctrine/dbal does not support
@@ -110,10 +111,10 @@ public function handle()
110111 case $ this ->checkColumn ($ name , ['color ' , 'rgb ' ]):
111112 $ fieldType = 'color ' ;
112113 break ;
113- case $ this ->checkColumn ($ name , ['image ' , 'img ' , 'avatar ' ]) :
114+ case $ this ->checkColumn ($ name , ['image ' , 'img ' , 'avatar ' ]):
114115 $ fieldType = 'image ' ;
115116 break ;
116- case $ this ->checkColumn ($ name , ['file ' , 'attachment ' ]) :
117+ case $ this ->checkColumn ($ name , ['file ' , 'attachment ' ]):
117118 $ fieldType = 'file ' ;
118119 break ;
119120 default :
@@ -155,20 +156,19 @@ public function handle()
155156 // set column comment
156157 $ comment = $ comment ? $ comment : $ name ;
157158
158-
159159 $ adminForm .= "\$form-> {$ fieldType }(' {$ name }', ' {$ comment }')->default( {$ defaultValue }); \n" ;
160160 }
161161 $ this ->alert ("laravel-admin form filed generator for {$ modelName }: " );
162162 $ this ->info ($ adminForm );
163163 }
164-
165164 }
166165
167166 /**
168167 * Check if the table column contains the specified keywords of the array.
169168 *
170169 * @param string $haystack
171- * @param array $needle
170+ * @param array $needle
171+ *
172172 * @return bool
173173 */
174174 private function checkColumn (string $ haystack , array $ needle )
@@ -178,10 +178,10 @@ private function checkColumn(string $haystack, array $needle)
178178 return true ;
179179 }
180180 }
181+
181182 return false ;
182183 }
183184
184-
185185 /**
186186 * Get the console command options.
187187 *
@@ -191,7 +191,7 @@ protected function getOptions()
191191 {
192192 return [
193193 ['model ' , null , InputOption::VALUE_REQUIRED ,
194- 'The eloquent model that should be use as controller data source. ' ,],
194+ 'The eloquent model that should be use as controller data source. ' , ],
195195 ];
196196 }
197197}
0 commit comments