Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel: Checking Schema has database view?

Tags:

php

laravel

How do i check, when php artisan migrate is working, has database view?

Something like this,

if(Schema::hasView('search_content')) {
    return;
}
like image 852
alprnkeskekoglu Avatar asked Sep 07 '25 10:09

alprnkeskekoglu


1 Answers

Try this,

\DB::select("SELECT * FROM information_schema.VIEWS WHERE TABLE_NAME='table_name'")

like image 74
Ali İhsan Şepar Avatar answered Sep 10 '25 03:09

Ali İhsan Şepar