Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Laravel Eloquent ORM to make an or statement

How to use Laravel Eloquent ORM to make an OR statement?

I know I can make multiple select like this (AND)

Order::where('id', '<', $myid)->where('finance','ok')->get();
like image 647
katerinaMark Avatar asked Sep 02 '13 13:09

katerinaMark


1 Answers

Order::where('id', '<', $myid)->orWhere('finance','ok')->get();

That gives you the OR

http://laravel.com/docs/queries#advanced-wheres gives you more details but it's the orWhere that is interesting to us here.

like image 135
ridecar2 Avatar answered Sep 28 '22 01:09

ridecar2