@vladjen can you show your form in the view?
Jan 9, 2020
3
Level 1
Request Implode in query
I am passing my form values to my controller function and i am filtering with the request values and returning to my view.
$posts = DB::table('posts')
->join('images', 'posts.id', '=', 'images.post_id')
->select('images.*','posts.*')
->where(array('posts.user_type' => 'isUser',
'posts.status' => '2',
'images.position' => '1',
'posts.'.$request->condition => $request->condition)) //how do i overcome this ?
->orderBy('posts.created_at','desc')
->get();
request->condition instead of that if i place my condition the query works of course. I have more than 5 different values in the form so i am trying to achieve this getting the request value straightaway. Please show me a way or suggest me a way.
Please or to participate in this conversation.