@@ -37,7 +37,7 @@ public function build()
3737 $ this ->files = $ cached ['files ' ];
3838 $ this ->enum = $ cached ['enum ' ];
3939 $ this ->names ();
40- $ template = (string ) $ this ->loadTemplate ();
40+ $ template = (string )$ this ->loadTemplate ();
4141 $ template = $ this ->buildParts ($ template );
4242 $ this ->publish ($ template );
4343 }
@@ -47,7 +47,7 @@ public function buildCustom($name)
4747 $ this ->template = __DIR__ . DIRECTORY_SEPARATOR . '.. ' . DIRECTORY_SEPARATOR . 'Templates ' . DIRECTORY_SEPARATOR . 'customController ' ;
4848 $ this ->name = $ name ;
4949 $ this ->names ();
50- $ template = (string ) $ this ->loadTemplate ();
50+ $ template = (string )$ this ->loadTemplate ();
5151 $ template = $ this ->buildParts ($ template );
5252 $ this ->publish ($ template );
5353 }
@@ -165,18 +165,18 @@ public function relationshipsBuilder()
165165 foreach ($ this ->fields as $ field ) {
166166 if ($ field ->type == 'relationship ' ) {
167167 // Formatting fix if the relationship is not first
168- if (!$ first ) {
168+ if (! $ first ) {
169169 $ relationships .= ' ' ;
170170 }
171171 $ menu = $ menus [$ field ->relationship_id ];
172172 $ relationships .= '$ '
173- . $ field ->relationship_name
174- . ' = '
175- . ucfirst (Str::camel ($ menu ->name ))
176- . '::lists (" '
177- . $ field ->relationship_field
178- . '", "id")->prepend( \'Please select \', \'\' ); '
179- . "\r\n" ;
173+ . $ field ->relationship_name
174+ . ' = '
175+ . ucfirst (Str::camel ($ menu ->name ))
176+ . '::pluck (" '
177+ . $ field ->relationship_field
178+ . '", "id")->prepend( \'Please select \', null ); '
179+ . "\r\n" ;
180180 }
181181 }
182182
@@ -210,7 +210,7 @@ public function compactBuilder()
210210 }
211211 }
212212 if ($ this ->enum > 0 ) {
213- if (!isset ($ first )) {
213+ if (! isset ($ first )) {
214214 $ first = true ;
215215 }
216216 foreach ($ this ->fields as $ field ) {
@@ -281,7 +281,7 @@ private function names()
281281 */
282282 private function publish ($ template )
283283 {
284- if (!file_exists (app_path ('Http ' . DIRECTORY_SEPARATOR . 'Controllers ' . DIRECTORY_SEPARATOR . 'Admin ' ))) {
284+ if (! file_exists (app_path ('Http ' . DIRECTORY_SEPARATOR . 'Controllers ' . DIRECTORY_SEPARATOR . 'Admin ' ))) {
285285 mkdir (app_path ('Http ' . DIRECTORY_SEPARATOR . 'Controllers ' . DIRECTORY_SEPARATOR . 'Admin ' ));
286286 chmod (app_path ('Http ' . DIRECTORY_SEPARATOR . 'Controllers ' . DIRECTORY_SEPARATOR . 'Admin ' ), 0777 );
287287 }
0 commit comments