model = $model; $this->action = $action; if($this->action === "log"){ $this->subject = 'mivita Logger'; } } public function build() { $content = ""; if($this->action === "log"){ $title = "New Log"; if($this->model->user_id && $this->model->user){ $content .= "From User: ".$this->model->user->id." | ".$this->model->user->email."\n"; } if($this->model->model && $this->model->model_id){ $content .= "Apply: ".$this->model->model." | ".$this->model->model_id."\n"; if($this->model->model === 'App\User'){ $apply = User::find($this->model->model_id); $content .= $this->model->model.": ".$apply->email." | ".$this->model->model_id."\n"; } } $content .= "\n"; $content .= "Action: ".$this->model->action."\n"; $content .= "Message: ".$this->model->message."\n"; $content .= "\n"; $content .= "Channel: ".$this->model->channel."\n"; $content .= "Level: ".$this->model->getLevelType()."\n"; $content .= "\n"; $content .= "Time: ".$this->model->created_at->format("d.m.Y H:i"); } return $this->view('emails.sys')->with([ 'title' => $title, 'content' => $content, ]); } }