now I have function for grabbing events (it will give participant id also), but I have another table as participant_data with participant_id and I need filter by status them
public function eventSearch(Request $request)
{
return ParticipantEvent::with('participant')
->where('end_date', '>=', Carbon::now())
->get()
->map(function($event) {
$event->url = route('public::participant::show', ['participant' => $event->participant]);
$participant = collect($event->participant->toArray())->all();
return $event;
});
}
I got solution to get the participants, with statuses:
$participants = Participant::where(
function ($query) {
$query->whereHas(
'participantElections',
function ($subQuery) {
$subQuery->where('status', '=', 'good');
}
)
}
)->get();
return $participants;
But how to combine this 2 solutions?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire