whereDate('dispatch_date', '=', Carbon::today()); })->get(); foreach ($containers as $container){ foreach ($container->packingLists as $packingList){ if(!($packingList->owner instanceof Order)) continue; $user = $packingList->owner->companyModule->employees()->first(); if(app()->environment(['production'])) { $user->notify(new ShipmentDepartureEmail($user, $packingList)); } } } } }