Level 55
@lionheartblue not elegant solution and specific to MySql, but should works
$jobFields = collect(\DB::select('describe jobs'))->pluck('Field')->toArray();
3 likes
Hi,
So, I am using the following code to get a list of column fields:
$jobFields = Schema::getColumnListing('jobs');
But this returns the columns in alphabetical order (by Name).
How can I preserve the order they appear in the table? So for example, "ID" comes first instead of appearing half way down the list.
@lionheartblue not elegant solution and specific to MySql, but should works
$jobFields = collect(\DB::select('describe jobs'))->pluck('Field')->toArray();
Please or to participate in this conversation.