'debug', 2 => 'info', 3 => 'notice', 4 => 'warning', 5 => 'error', 6 => 'critical', 7 => 'alert', ]; function __construct($action = null, $channel = 'default', $level = 1) { $this->log = new Logger(); $this->log->action = $action; $this->log->channel = $channel; $this->log->level = $level; } public static function action($action = null, $channel = 'default', $level = 1) { //Return new instance of this model return new self($action, $channel, $level); } public function setModel($id, $model){ $this->log->model_id = $id; $this->log->model = $model; return $this; } public function setUserId($user_id){ $this->log->user_id = $user_id; return $this; } public function setMessage($message){ $this->log->message = $message; return $this; } public function save(){ $this->log->save(); //send Mail if($this->log->level >= 3){ $mail = config('app.info_test_mail'); Mail::to($mail)->send(new MailSyS($this->log, 'log')); } } }