Divyesh pal
Divyesh pal

Reputation: 947

Integrating Mysql views with Laravel Models

I have multiple tables say Users , Location, terms and services i want to make a mysql view because every time i have to make a join statement for fetching the desired result. please help how to get it accomplished? Thanks!

Upvotes: 0

Views: 344

Answers (1)

m1kfb
m1kfb

Reputation: 121

Are you asking how to create a view or read it Laravel?

CREATE VIEW vw_MyView AS

You could use Query Builder

   $rows = \DB::select('select * from vw_MyView');
    foreach ($rows as $row) {
        var_dump($row->field);
    }

Upvotes: 1

Related Questions