From b047ee8fda64b9a3b2be7520514a2b54cc49dc17 Mon Sep 17 00:00:00 2001 From: printempw Date: Sat, 21 Jul 2018 21:52:43 +0800 Subject: [PATCH] Add report() helper function --- app/Http/Controllers/AuthController.php | 2 +- app/helpers.php | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/AuthController.php b/app/Http/Controllers/AuthController.php index 313bd3ae..9fdcd26f 100644 --- a/app/Http/Controllers/AuthController.php +++ b/app/Http/Controllers/AuthController.php @@ -197,7 +197,7 @@ class AuthController extends Controller Log::info("[Password Reset] Mail has been sent to [{$request->input('email')}] with token [$token]"); } catch (\Exception $e) { // Write the exception to log - app(\Illuminate\Foundation\Exceptions\Handler::class)->report($e); + report($e); return json(trans('auth.mail.failed', ['msg' => $e->getMessage()]), 2); } diff --git a/app/helpers.php b/app/helpers.php index adbcdc71..29bc3764 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -493,3 +493,16 @@ if (! function_exists('get_db_config')) { return config("database.connections.$type"); } } + +if (! function_exists('report')) { + /** + * Report an exception. + * + * @param \Exception $exception + * @return void + */ + function report($exception) + { + app(Illuminate\Contracts\Debug\ExceptionHandler::class)->report($exception); + } +}