diff --git a/src/Commands/InstallCommand.php b/src/Commands/InstallCommand.php index 3255f4b..4a8b96f 100644 --- a/src/Commands/InstallCommand.php +++ b/src/Commands/InstallCommand.php @@ -86,14 +86,14 @@ public function handle(Filesystem $filesystem) file_put_contents(app_path('User.php'), $str); } } else { - $this->warn('Unable to locate "app/User.php". Did you move this file?'); + $this->warn('Unable to locate "app/Models/User.php". Did you move this file?'); $this->warn('You will need to update this manually. Change "extends Authenticatable" to "extends \Classiebit\Eventmie\Models\User" in your User model'); } // ---- Check if everything good so far ---- $this->info('---- Dumping the autoloaded files and reloading all new files ----'); $composer = $this->findComposer(); - $process = new Process($composer.' dump-autoload'); + $process = new Process([$composer.' dump-autoload']); // Setting timeout to null to prevent installation from stopping at a certain point in time $process->setTimeout(null); $process->setWorkingDirectory(base_path())->run(); diff --git a/src/EventmieServiceProvider.php b/src/EventmieServiceProvider.php index 123a007..5a75c59 100644 --- a/src/EventmieServiceProvider.php +++ b/src/EventmieServiceProvider.php @@ -188,15 +188,43 @@ private function registerConsoleCommands() */ private function mailConfiguration($mail = []) { - Config::set('mail.host', $mail['mail_host']); - Config::set('mail.port', $mail['mail_port']); - Config::set('mail.driver', $mail['mail_driver']); - Config::set('mail.from', ['address' => $mail['mail_sender_email'], - 'name' => $mail['mail_sender_name'] - ]); - Config::set('mail.encryption', $mail['mail_encryption']); - Config::set('mail.username', $mail['mail_username']); - Config::set('mail.password', $mail['mail_password']); + // defaults + $MAIL_MAILER = 'smtp'; + $MAIL_HOST = 'smtp.mailtrap.io'; + $MAIL_PORT = '2525'; + $MAIL_USERNAME = null; + $MAIL_PASSWORD = null; + $MAIL_ENCRYPTION = null; + $MAIL_FROM_ADDRESS = null; + $MAIL_FROM_NAME = "EventmiePro@classiebit"; + if( + !empty($mail['mail_host']) && + !empty($mail['mail_port']) && + !empty($mail['mail_driver']) && + !empty($mail['mail_sender_email']) && + !empty($mail['mail_sender_name']) && + !empty($mail['mail_encryption']) && + !empty($mail['mail_username']) && + !empty($mail['mail_password']) + ) + { + $MAIL_MAILER = $mail['mail_driver']; + $MAIL_HOST = $mail['mail_host']; + $MAIL_PORT = $mail['mail_port']; + $MAIL_USERNAME = $mail['mail_username']; + $MAIL_PASSWORD = $mail['mail_password']; + $MAIL_ENCRYPTION = $mail['mail_encryption']; + $MAIL_FROM_ADDRESS = $mail['mail_sender_email']; + $MAIL_FROM_NAME = $mail['mail_sender_name']; + } + + Config::set('mail.driver', $MAIL_MAILER); + Config::set('mail.host', $MAIL_HOST); + Config::set('mail.port', $MAIL_PORT); + Config::set('mail.username', $MAIL_USERNAME); + Config::set('mail.password', $MAIL_PASSWORD); + Config::set('mail.encryption', $MAIL_ENCRYPTION); + Config::set('mail.from', ['address' => $MAIL_FROM_ADDRESS, 'name' => $MAIL_FROM_NAME]); } diff --git a/src/Exceptions/MyHandler.php b/src/Exceptions/MyHandler.php index 49ff6f7..d289db7 100644 --- a/src/Exceptions/MyHandler.php +++ b/src/Exceptions/MyHandler.php @@ -5,6 +5,7 @@ use Exception; use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; use Illuminate\Auth\AuthenticationException; +use Throwable; class MyHandler extends ExceptionHandler { @@ -27,28 +28,20 @@ class MyHandler extends ExceptionHandler 'password_confirmation', ]; + /** - * Report or log an exception. + * Register the exception handling callbacks for the application. * - * @param \Exception $exception * @return void */ - public function report(Exception $exception) + public function register() { - parent::report($exception); + $this->reportable(function (Throwable $e) { + // + }); } + - /** - * Render an exception into an HTTP response. - * - * @param \Illuminate\Http\Request $request - * @param \Exception $exception - * @return \Illuminate\Http\Response - */ - public function render($request, Exception $e) - { - return parent::render($request, $e); - } protected function unauthenticated($request, AuthenticationException $exception) {