first commit
This commit is contained in:
commit
0baac018a2
1011 changed files with 145854 additions and 0 deletions
63
app/Mail/MailSyS.php
Normal file
63
app/Mail/MailSyS.php
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
<?php
|
||||
namespace App\Mail;
|
||||
|
||||
use App\User;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
|
||||
class MailSyS extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
protected $model;
|
||||
protected $action;
|
||||
|
||||
public $subject;
|
||||
|
||||
public function __construct($model, $action)
|
||||
{
|
||||
$this->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,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue