Skip to content

Commit

Permalink
Update for Laravel 5
Browse files Browse the repository at this point in the history
  • Loading branch information
jenssegers committed Feb 8, 2015
1 parent 73a9c43 commit 436a5c7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"rollbar/rollbar": "0.9.*"
},
"require-dev": {
"orchestra/testbench": "2.2.*",
"orchestra/testbench": "3.0.*",
"mockery/mockery": "*",
"satooshi/php-coveralls": "*"
},
Expand Down
19 changes: 15 additions & 4 deletions src/RollbarServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,22 @@ public function boot()
$app['rollbar.handler']->log($level, $message, $context);
});

// Register Laravel shutdown function
$this->app->shutdown(function() use ($app)
if (method_exists($app, 'version') and starts_with($app->version(), '5'))
{
$app['rollbar.client']->flush();
});
// Register Laravel 5 shutdown function
$this->app->terminating(function() use ($app)
{
$app['rollbar.client']->flush();
});
}
else
{
// Register Laravel 4 shutdown function
$this->app->shutdown(function() use ($app)
{
$app['rollbar.client']->flush();
});
}

// Register PHP shutdown function
register_shutdown_function(function() use ($app)
Expand Down
2 changes: 1 addition & 1 deletion tests/RollbarTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public function tearDown()
Mockery::close();
}

protected function getPackageProviders()
protected function getPackageProviders($app)
{
return ['Jenssegers\Rollbar\RollbarServiceProvider'];
}
Expand Down

0 comments on commit 436a5c7

Please sign in to comment.