/** * Send an email to a model. * * @param string $subject * @param string $view * @param array $data * @param bool $condition */ public function emailOn($subject, $view, $data = [], $condition = true) { $recipient = $this->email; if (!$condition || !$recipient) { return; } // Serialize data $data['user'] = $this; $data = Collection::serialize($data); // Send email Mail::queue($view, $data, function ($message) use($recipient, $subject) { $message->subject($subject)->to($recipient); }); }
/** * Get the routes as a collection. * * @return Collection */ public function getRoutesCollection() { return Collection::make($this->getRoutes())->sortBy('uri'); }