Terry Djony
Terry Djony

Reputation: 2015

Query design pattern

How to do something like :

$user = $query->table('user')->select('name','email')->where('id > 3');

I mean, How to make the query know that the action ends in where('id > 3') so it will execute ? Then, when we add ->orderBy('date'), it won't execute after the query is finished build up..

Is it possible to do this ?

Should there be exec() method at the very end of action ?
However, I see Laravel can do this

Upvotes: 0

Views: 62

Answers (1)

Sohel0415
Sohel0415

Reputation: 9853

You can do like the following, It works fine

$user = $query->table('user')->select('name','email')->where('id' ,'>' 3)->get();

Upvotes: 1

Related Questions