How to check table is exists or not in Laravel?

Share Me
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

Today now in this post i would like to show you How to check table is exists or not in Laravel. Laravel provide us database migrations by using Schema facade. We know Schema facade have several method like add column, remove column, check if the table exists, check if the column exists etc.

Now in the bellow example we can see how to detect if a database table is exists with Schema Builder. We know sometimes we need to check if table exists then need to do something etc.

So we can check this on that way:

Example:

Schema::hasTable('yourTable');

Read Also : How to convert Object into Array in PHP?

Thanks for read. I hope it help you. For more you can follow us on facebook.

About code chef

My name is Shahriar sagor. I'm a developer. I live in Bangladesh and I love to write tutorials and tips that will help to other Developer's. I am a big fan of PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS and Bootstrap from the early stage.

View all posts by code chef →