userData = $userData; $this->destination = $destination; $this->ipAddress = $ipAddress; $this->exception = $exceptionData; $debug = $exceptionData; unset($debug['stackTrace']); Log::error('Exception is: ' . json_encode($debug)); } /** * Execute the job. * * @return void */ public function handle() { if ($this->attempts() < 3) { // mail? try { $email = env('SITE_OWNER'); $args = $this->exception; $args['loggedIn'] = $this->userData['id'] > 0; $args['user'] = $this->userData; $args['ip'] = $this->ipAddress; Mail::send( ['emails.error-html', 'emails.error'], $args, function (Message $message) use ($email) { if ($email != 'mail@example.com') { $message->to($email, $email)->subject('Caught an error in Firely III.'); } } ); } catch (Swift_TransportException $e) { // could also not mail! :o Log::error('Swift Transport Exception' . $e->getMessage()); } catch (ErrorException $e) { Log::error('ErrorException ' . $e->getMessage()); } } } }