Get all the column names for a table

1DB::getSchemaBuilder()->getColumnListing('users');
2/*
3returns [
4 'id',
5 'name',
6 'email',
7 'email_verified_at',
8 'password',
9 'remember_token',
10 'created_at',
11 'updated_at',
12];
13*/

Tip given by @aaronlumsden

Like our articles?

Become a Premium Member for $129/year or $29/month
What else you will get:
  • 22 courses (477 lessons, total 38 h 20 min)
  • 2 long-form tutorials (one new every week)
  • access to project repositories
  • access to private Discord