channel = $channel; $this->context = $context; $this->message = $message; $this->data = $data; $this->subject = 'mivita Log'; } public function build() { $title = 'Log: '.$this->channel.' '.$this->context; //make Data readable $this->data = json_encode($this->data, JSON_PRETTY_PRINT); $content = ""; $content .= "\n"; $content .= "Channel: ".$this->channel."\n"; $content .= "Context: ".$this->context."\n"; if(\Auth::check()){ $content .= "From User: ".\Auth::user()->id." | ".\Auth::user()->email."\n"; } $content .= "\n"; $content .= "Message: ".$this->message."\n"; $content .= "\n"; $content .= "Data: ".$this->data."\n"; $content .= "\n"; $content .= "\n"; $content .= "Time: ".now()->format("d.m.Y H:i"); $content .= "\n"; $content .= request()->header('User-Agent'); return $this->view('emails.sys')->with([ 'title' => $title, 'content' => $content, ]); } }