// Laravel Relation within realtions
$users = User::with(['posts' => function ($query) {
$query->where('title', 'like', '%code%')->with('comments');
}])->get();
//Single relationship
$billings = Billing::with('user')->get();
// sinlge with selected colums
$billings = Billing::with('user:id,name')->get();
// multiple relations
$billings = Biling::with(['user', 'subscription'])->get();
// nested relations
$schools = School::with('class.user')->get();
// Constraining Eager Loads
$users = User::with(['posts' => function ($query) {
$query->where('title', 'like', '%code%');
}])->get();
$users = User::with(['posts' => function ($query) {
$query->orderBy('created_at', 'desc');
}])->get();