Skip to content

Commit

Permalink
Fixed issues with larave 5.3+
Browse files Browse the repository at this point in the history
Specifically removed the session stuff since the addition of the web
middleware, sessions aren't enabled anywhere else.
  • Loading branch information
tsiedsma committed Jan 27, 2017
1 parent ddc077b commit 603641e
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 28 deletions.
13 changes: 6 additions & 7 deletions src/LithiumDev/ExceptionMailer/ExceptionHandler.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
<?php

namespace LithiumDev\ExceptionMailer;

use App;

use Exception;
use App\Exceptions\Handler;

class ExceptionHandler extends Handler
{
class ExceptionHandler extends Handler {

/**
*
* @param Exception $e
*
* @return type
*/
public function report(Exception $e)
Expand All @@ -21,8 +20,8 @@ public function report(Exception $e)
$reportableEnvironments = config('laravel-exception-mailer.config.notify_environment');
if (is_array($reportableEnvironments) && in_array(app()->environment(), $reportableEnvironments))
{
$nonReportableExceptions = config('laravel-exception-mailer.config.prevent_exception');
$shouldReport = true;
$nonReportableExceptions = config('laravel-exception-mailer.config.prevent_exception');
$shouldReport = true;

foreach ($nonReportableExceptions as $class)
{
Expand All @@ -43,7 +42,7 @@ public function report(Exception $e)

if ($shouldReport)
{
$eMailer = App::make('ExceptionMailer');
$eMailer = app()->make('ExceptionMailer');
$eMailer->notifyException($e);
}
}
Expand Down
28 changes: 12 additions & 16 deletions src/LithiumDev/ExceptionMailer/ExceptionMailer.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
<?php

namespace LithiumDev\ExceptionMailer;


use Illuminate\Support\Facades\Request;

/**
* Description of ExceptionMailer
*
Expand All @@ -30,17 +26,17 @@ public function notifyException($exception)
if (! empty($this->env))
{
$request = array();
$request['fullUrl'] = (! \App::runningInConsole()) ? Request::fullUrl() : null;
$request['input_get'] = (! \App::runningInConsole()) ? $_GET : [];
$request['input_post'] = (! \App::runningInConsole()) ? $_POST : [];
$request['input_old'] = (! \App::runningInConsole()) ? Request::old() : [];
$request['session'] = (! \App::runningInConsole()) ? \Session::all() : [];
$request['cookie'] = (! \App::runningInConsole()) ? Request::cookie() : [];
$request['file'] = (! \App::runningInConsole()) ? Request::file() : [];
$request['header'] = (! \App::runningInConsole()) ? Request::header() : [];
$request['server'] = (! \App::runningInConsole()) ? Request::server() : [];
$request['json'] = (! \App::runningInConsole()) ? Request::json() : [];
$request['request_format'] = (! \App::runningInConsole()) ? Request::format() : null;
$request['fullUrl'] = (! app()->runningInConsole()) ? \Request::fullUrl() : null;
$request['input_get'] = (! app()->runningInConsole()) ? $_GET : [];
$request['input_post'] = (! app()->runningInConsole()) ? $_POST : [];
$request['input_old'] = [];
$request['session'] = [];
$request['cookie'] = (! app()->runningInConsole()) ? \Request::cookie() : [];
$request['file'] = (! app()->runningInConsole()) ? \Request::file() : [];
$request['header'] = (! app()->runningInConsole()) ? \Request::header() : [];
$request['server'] = (! app()->runningInConsole()) ? \Request::server() : [];
$request['json'] = (! app()->runningInConsole()) ? \Request::json() : [];
$request['request_format'] = (! app()->runningInConsole()) ? \Request::format() : null;
$request['error'] = $exception->getTraceAsString();
$request['subject_line'] = $exception->getMessage();
$request['class_name'] = get_class($exception);
Expand All @@ -53,7 +49,7 @@ public function notifyException($exception)
$message->to($recipient['address'], $recipient['name']);
}

$subject = (! \App::runningInConsole()) ? "URL: " . $request['fullUrl'] : " CLI Command Failure";
$subject = (! app()->runningInConsole()) ? "URL: " . $request['fullUrl'] : " CLI Command Failure";
$message->subject("{$this->config['subject']} - " . $subject);
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

namespace LithiumDev\ExceptionMailer;


Expand All @@ -22,8 +21,8 @@ public function boot()
{
$this->publishes([
__DIR__ . '/../../config/config.php' => config_path('laravel-exception-mailer/config.php'),
__DIR__ . '/../../views' => base_path('resources/views/vendor/laravel-exception-mailer'),
]);
__DIR__ . '/../../views' => base_path('resources/views/vendor/laravel-exception-mailer'),
]);
$this->loadViewsFrom(__DIR__ . '/../../views', 'laravel-exception-mailer');

$this->app->singleton('Illuminate\Contracts\Debug\ExceptionHandler', 'LithiumDev\ExceptionMailer\ExceptionHandler');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

namespace LithiumDev\ExceptionMailer\Facades;


use Illuminate\Support\Facades\Facade;

class ExceptionMailerFacade extends Facade {
Expand All @@ -11,7 +11,8 @@ class ExceptionMailerFacade extends Facade {
*
* @return string
*/
protected static function getFacadeAccessor() {
protected static function getFacadeAccessor()
{
return 'ExceptionMailer';
}

Expand Down

0 comments on commit 603641e

Please sign in to comment.