Support the ongoing development of Laravel.io →
Database
Last updated 2 years ago.
0

The schema builder does not have the ability to create views so you have to write the sql necessary to create them manually in your migration classes.

Just create a migration like usual then delete everything in the up and down methods and replace it with the queries need to create and drop the view.

DB::statement('CREATE VIEW ...');
DB::statement('DROP VIEW ...');

Keep in mind this will only work if you are using mysql.

Last updated 2 years ago.
0

Thanks spekkionu......

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.