public function queue($subject, $body, $notificationType, $action) { $notificationsToQueueEmailsFor = Notification::where('notification_type_id', $notificationType)->get(); foreach ($notificationsToQueueEmailsFor as $notification) { $email = new Email(); $email->notification()->associate($notification); $email->subject = $subject; $email->body = $body; $email->status = $action; $email->save(); } }