Answers for "laravel load relationship"

PHP
0

laravel how to query belongsTo relationship

$movies = Movie::whereHas('director', function($q) {
    $q->where('name', 'great');
})->get();
Posted by: Guest on October-12-2020
1

eloquent relationships

$roles = App\User::find(1)->roles()->orderBy('name')->get();
Posted by: Guest on June-15-2020
-1

laravel load relationship

use App\Models\Book;

$books = Book::all();

if ($someCondition) {
    $books->load('author', 'publisher');
}
Posted by: Guest on September-27-2021

Code answers related to "laravel load relationship"

Browse Popular Code Answers by Language