This is an array : $request->all();. You cant concatenate it with a string.
Jun 24, 2015
2
Level 2
Array to string conversion Error
Hi! I'm just doing a normal search function I was following the tutorial of Search elementls and when I was already in my controller I got the query and it fais with this error:
ErrorException in EventsController.php line 171: Array to string conversion
public function search(Request $request)
{
$query = $request->all();
$resutl = DB::table('events')->where('name','LIKE', '.%'. $query.'%.')->get();
dd($resutl);
}
public function search(Request $request)
{
$query = $request->all();
$events = Event::where('name','LIKE', ".%$query%.")->get();
dd($events);
}
I've got the same error both times, any clue?
PD: the url query looks like it has some crappy added, when I was trying to look for matches with "ie" I've got this.
192.168.1.112:5555/events/%7Bquery%7D?q=ie
Thanks in advance.
Level 56
Please or to participate in this conversation.