You may check for the existence of a table in the Laravel application. Laravel provides Schema::hasTable() method to check whether a table exists or not. In this tutorial, I will show how to check whether a table exists or not in Laravel application.

It is good practice to laravel create table if not exists. Let's see the example code of how to check if table exists laravel:

<?php

use Illuminate\Support\Facades\Schema;

if (Schema::hasTable('users')) {
    // The "users" table exists...
}

 

Read also: How To Check If A Column Exists In Laravel Table?

 

Conclusion

I have tried to discuss the clear concept of how to check if a table exists in laravel. Now we know how to check if table exists laravel. Hope this laravel skip migration if table exists tutorial will help you.