I need to get name and id from my user table, name is in two column as
last_name. This is what I have done
$user = User::select('id',DB::raw("CONCAT(`first_name`, ' ' ,`last_name`) AS name")) ->where('name', 'like' ,$token)
which gives me an error
Unknown column 'name' in 'where clause'. I printed out the raw sql which looks like this
select `id`, CONCAT(`first_name`, ' ' ,`last_name`) AS name from `user` where `name` like ? and `user`.`deleted_at` is null
How can I use concat and like with my eloquent builder properly?