private function setLERNNotificationFormat() { //Change the subject LERN::setSubject("[" . Setting::get('lern.notify.channel') . "]: An Exception was thrown! (" . date("D M d, Y G:i", time()) . " UTC)"); //Change the message body LERN::setMessage(function (Exception $exception) { $url = Request::url(); $method = Request::method(); $user = Auth::user(); if ($user) { $user_id = $user->id; $user_name = $user->username; $user_first_name = $user->first_name; $user_last_name = $user->last_name; } else { $user_id = 'N/A'; $user_name = 'unauthenticated'; $user_first_name = 'Unauthenticated User'; $user_last_name = 'N/A'; } $exception_class = get_class($exception); $exception_file = $exception->getFile(); $exception_line = $exception->getLine(); $exception_message = $exception->getMessage(); $exception_trace = $exception->getTrace(); $input = Input::all(); if (!empty($input)) { if (array_has($input, 'password')) { $input['password'] = "******"; $input['password_confirmation'] = "hidden-secret"; } $input = json_encode($input); } else { $input = ""; } $exception_trace_formatted = []; foreach ($exception->getTrace() as $trace) { $formatted_trace = ""; if (isset($trace['function']) && isset($trace['class'])) { $formatted_trace = sprintf('at %s%s%s(...)', Utils::formatClass($trace['class']), $trace['type'], $trace['function']); } else { if (isset($trace['function'])) { $formatted_trace = sprintf('at %s(...)', $trace['function']); } } if (isset($trace['file']) && isset($trace['line'])) { $formatted_trace .= Utils::formatPath($trace['file'], $trace['line']); } $exception_trace_formatted[] = $formatted_trace; } $view = View::make('emails.html.lern_notification', compact('url', 'method', 'user_id', 'user_name', 'user_first_name', 'user_last_name', 'exception_class', 'exception_file', 'exception_line', 'exception_message', 'exception_trace', 'exception_trace_formatted', 'input')); $msg = $view->render(); return $msg; }); }