Skip to content

Commit

Permalink
compatible laravel 8
Browse files Browse the repository at this point in the history
  • Loading branch information
classiebit-sumit committed Dec 7, 2020
1 parent 83adefb commit 0b35257
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 26 deletions.
4 changes: 2 additions & 2 deletions src/Commands/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
46 changes: 37 additions & 9 deletions src/EventmieServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]);

}

Expand Down
23 changes: 8 additions & 15 deletions src/Exceptions/MyHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Exception;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Illuminate\Auth\AuthenticationException;
use Throwable;

class MyHandler extends ExceptionHandler
{
Expand All @@ -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)
{
Expand Down

0 comments on commit 0b35257

Please sign in to comment.