Laravel, jak zapytać o związek przynależności
$movies = Movie::whereHas('director', function($q) {
$q->where('name', 'great');
})->get();
Fragile Flatworm
$movies = Movie::whereHas('director', function($q) {
$q->where('name', 'great');
})->get();
$roles = App\User::find(1)->roles()->orderBy('name')->get();
use App\Models\Book;
$books = Book::all();
if ($someCondition) {
$books->load('author', 'publisher');
}