Skip to content
Advertisement

Larawel orWhere query from concat two column

I have a users table: id | firstname | lastname when displaying users data, I have a filter name so a user can search by name (first, last or full name); the problem is when I input it fullname it result in 0 data, eg: fistname: michael lastname: foobar when i look for “michael” and “foobar” i have no problem, but when i look for “michael foobar” it return nothing

my code look like this:

JavaScript

ps: I’m sorry for my lack of english, i hope y’all understand

Advertisement

Answer

You are using mysql in-built function CONCAT_WS, plz use DB::raw() for the function:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement