How can i pass multiple where clause into eloquent query
having the below code but is returning empty json object
$cycle = $request->cycle;
$day = $request->day;
$Data = Cohort::where(['cycle' => $cycle, 'day' => $day]);
return response()->json([
'Message' => 'Data Retrieved Successfully',
'Data' => $Data
], 200);
but you are just making the query without executing it, you will have to append ->get() at the end so it returns results
$Data = Cohort::where(['cycle' => $cycle, 'day' => $day])->get();
or separate the where clauses:
$Data = Cohort::where('cycle', $cycle)->where( 'day', $day)->get();
Please or to participate in this conversation.