I have a cars table, and a car_image table.
I want to get all the cars that have NO images in the car_image.
In my car model I am making a scope:
public function scopeNoImages($query)
return $query-> ??
How can I create a scope that will show only results from the cars table that have no related rows in the pivot table?
Best How To :
Assuming the car_image consists of the images of the cars:
public function images()
public function car()
Now you can load the cars without images like so: