Skip to content

Commit

Permalink
Merge pull request #12 from mikemclin/master
Browse files Browse the repository at this point in the history
Normalize version format #11
  • Loading branch information
mpociot authored Sep 2, 2016
2 parents d41a46c + f2913bd commit 98401c0
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/Notifications/NotificationServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function boot()
], 'laravel-notifications');
}

if (version_compare($this->app->version(), '5.2', '<')) {
if (version_compare($this->getAppVersion(), '5.2', '<')) {
$this->app->make(Bus::class)->maps([
SendQueuedNotifications::class => SendQueuedNotificationsHandler::class . '@handle',
]);
Expand Down Expand Up @@ -70,4 +70,18 @@ protected function registerCommands()
'command.notification.table'
]);
}

/**
* Get the version number of the application.
*
* @return string
*/
private function getAppVersion()
{
$version = $this->app->version();
if (substr($version, 0, 7) === 'Lumen (') {
$version = array_first(explode(')', str_replace('Lumen (', '', $version)));
}
return $version;
}
}

0 comments on commit 98401c0

Please sign in to comment.