Only until March 18th: coupon LARAVEL12 for 40% off Yearly/Lifetime membership!

Read more here

Checking For Table / Column Existence

You may check for the existence of a table or column using the hasTable and hasColumn methods:

if (Schema::hasTable('users')) {
// The "users" table exists...
}
 
if (Schema::hasColumn('users', 'email')) {
// The "users" table exists and has an "email" column...
}

Tip given by @dipeshsukhia

Like our articles?

Become a Premium Member for $129/year or $29/month
What else you will get:
  • 71 courses
  • 93 long-form tutorials
  • access to project repositories
  • access to private Discord

Recent New Courses