From ebf3602134b42ea60eb0a6ba124752fa5a071c55 Mon Sep 17 00:00:00 2001 From: fahedtms Date: Mon, 9 May 2022 15:09:22 +0400 Subject: [PATCH] initial release --- README.md | 5 +++++ config/exception-mail.php | 5 +++++ src/Exceptions/Handler.php | 6 ++++-- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e917a44..f03f5c7 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,11 @@ This is the contents of the file which will be published at `config/exception-ma ```php return [ + /* + * enable or disable the package + */ + 'enabled' => true, + /* * Add email addresses you want them to receive the exception */ diff --git a/config/exception-mail.php b/config/exception-mail.php index 28d6b4c..b8da880 100644 --- a/config/exception-mail.php +++ b/config/exception-mail.php @@ -1,6 +1,11 @@ true, + /* * Add email addresses you want them to receive the exception */ diff --git a/src/Exceptions/Handler.php b/src/Exceptions/Handler.php index 538d86c..a7d4a3d 100644 --- a/src/Exceptions/Handler.php +++ b/src/Exceptions/Handler.php @@ -63,7 +63,9 @@ public function report(Throwable $e) public function sendEmail(Throwable $e) { - $addresses = Config::get('exception-mail.addresses', []); - Mail::to($addresses)->send(new ExceptionOccurred($e->getMessage())); + if (Config::get('enabled')) { + $addresses = Config::get('exception-mail.addresses', []); + Mail::to($addresses)->send(new ExceptionOccurred($e->getMessage())); + } } }