Laravel eloquent

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']) ;


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *