find with where relationship
$data = Time::whereDoesntHave('slots', function($q) {
$q->whereDate('slots.date', '2024-06-16');
})->get()->pluck('name', 'id');
$data = Slot::whereHas('coach', function($q) {
$q->where('coach_slot.coach_id', auth()->user()->coach->first()->id);
})->get()Get selected field only
Data::get(['field1','field2']) ;
Leave a Reply