File tree 3 files changed +25
-0
lines changed
3 files changed +25
-0
lines changed Original file line number Diff line number Diff line change 395
395
*/
396
396
'with_property_constants ' => false ,
397
397
398
+ /*
399
+ |--------------------------------------------------------------------------
400
+ | Optionally includes a full list of columns in the base generated models,
401
+ | which can be used to avoid making calls like
402
+ |
403
+ | ...
404
+ | \Illuminate\Support\Facades\Schema::getColumnListing
405
+ | ...
406
+ |
407
+ | which can be slow, especially for large tables.
408
+ */
409
+ 'with_column_list ' => false ,
410
+
398
411
/*
399
412
|--------------------------------------------------------------------------
400
413
| Disable Pluralization Name
Original file line number Diff line number Diff line change @@ -455,6 +455,13 @@ protected function body(Model $model)
455
455
$ body .= $ this ->class ->field ('snakeAttributes ' , false , ['visibility ' => 'public static ' ]);
456
456
}
457
457
458
+ if ($ model ->usesColumnList ()) {
459
+ $ properties = array_keys ($ model ->getProperties ());
460
+
461
+ $ body .= "\n" ;
462
+ $ body .= $ this ->class ->field ('columns ' , $ properties );
463
+ }
464
+
458
465
if ($ model ->hasCasts ()) {
459
466
$ body .= $ this ->class ->field ('casts ' , $ model ->getCasts (), ['before ' => "\n" ]);
460
467
}
Original file line number Diff line number Diff line change @@ -1210,6 +1210,11 @@ public function usesPropertyConstants()
1210
1210
return $ this ->config ('with_property_constants ' , false );
1211
1211
}
1212
1212
1213
+ public function usesColumnList ()
1214
+ {
1215
+ return $ this ->config ('with_column_list ' , false );
1216
+ }
1217
+
1213
1218
/**
1214
1219
* @return int
1215
1220
*/
You can’t perform that action at this time.
0 commit comments