php - Laravel-5 'LIKE' equivalent (Eloquent) -


i'm using below code pull results database laravel 5.

bookingdates::where('email', input::get('email'))->orwhere('name', 'like', input::get('name'))->get() 

however, orwherelike doesn't seem matching results. code produce in terms of mysql statements?

i'm trying achieve following:

select * booking_dates email='my@email.com' or name '%john%' 

thanks in advance.

if want see run in database use dd(db::getquerylog()) see queries run.

try this

bookingdates::where('email', input::get('email'))     ->orwhere('name', 'like', '%' . input::get('name') . '%')->get(); 

Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -