How to check table is exists or not in our database in Laravel?

We can use hasTable() to check table exists in our database or not.

Syntax

Schema::hasTable('users'); // here users are the table name.

if(Schema::hasTable('users')) {
   // table is exists
} else {
   // table is not exist
}

BY Best Interview Question ON 13 Jan 2023