message = $message; $record->level = $level; if ($details !== null) { $record->details = (array) $details; } try { $record->save(); } catch (Exception $ex) {} return $record; } /** * Beautify level value. * @param string $level * @return string */ public function getLevelAttribute($level) { return ucfirst($level); } /** * Creates a shorter version of the message attribute, * extracts the exception message or limits by 100 characters. * @return string */ public function getSummaryAttribute() { if (preg_match("/with message '(.+)' in/", $this->message, $match)) { return $match[1]; } return Str::limit($this->message, 100); } }