This is for Laravel 5.2. My question is very similar to this question. Basically, I'm trying to run a query that was suggested to me in another question, which returns data when it actually executes:
>>> App\Models\User::whereRaw('CONCAT(name_first, " ", name_last) LIKE "%?%"', ['test'])->get()
=> Illuminate\Database\Eloquent\Collection {#769
all: [],
}
This is what the mysql log shows:
Prepare select * from `users` where CONCAT(name_first, " ", name_last) LIKE "%?%" and `users`.`deleted_at` is null
Close stmt
However, this statement works:
>>> App\Models\User::whereRaw('CONCAT(name_first, " ", name_last) LIKE "%test%"')->get()
=> Illuminate\Database\Eloquent\Collection {#770
all: [
App\Models\User {#767
id: 1,
name_first: "test",
name_middle: null,
name_last: "user",
email: "test@test.com",
},
],
}
And the associated mysql log entries:
Prepare select * from `users` where CONCAT(name_first, " ", name_last) LIKE "%test%" and `users`.`deleted_at` is null
Execute select * from `users` where CONCAT(name_first, " ", name_last) LIKE "%test%" and `users`.`deleted_at` is null
Close stmt
Any information or advice about why this is happening would be greatly appreciated.