Embrace contracts.
This commit is contained in:
parent
7c8b8e7dba
commit
4e5a151774
|
@ -1,25 +1,29 @@
|
|||
<?php namespace App\Providers;
|
||||
|
||||
use App, Log, Exception;
|
||||
use Exception;
|
||||
use Illuminate\Contracts\Logging\Log;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Contracts\Exception\Handler;
|
||||
|
||||
class ErrorServiceProvider extends ServiceProvider {
|
||||
|
||||
/**
|
||||
* Register any error handlers.
|
||||
*
|
||||
* @param Handler $handler
|
||||
* @param Log $log
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
public function boot(Handler $handler, Log $log)
|
||||
{
|
||||
// Here you may handle any errors that occur in your application, including
|
||||
// logging them or displaying custom views for specific errors. You may
|
||||
// even register several error handlers to handle different types of
|
||||
// exceptions. If nothing is returned, the default error view is
|
||||
// shown, which includes a detailed stack trace during debug.
|
||||
App::error(function(Exception $e)
|
||||
$handler->error(function(Exception $e) use ($log)
|
||||
{
|
||||
Log::error($e);
|
||||
$log->error($e);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php namespace App\Providers;
|
||||
|
||||
use Log;
|
||||
use Illuminate\Contracts\Logging\Log;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class LogServiceProvider extends ServiceProvider {
|
||||
|
@ -10,9 +10,9 @@ class LogServiceProvider extends ServiceProvider {
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
public function boot(Log $log)
|
||||
{
|
||||
Log::useFiles(storage_path().'/logs/laravel.log');
|
||||
$log->useFiles(storage_path().'/logs/laravel.log');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php namespace App\Providers;
|
||||
|
||||
use App, URL;
|
||||
use Illuminate\Contracts\Routing\UrlGenerator;
|
||||
use Illuminate\Routing\RouteServiceProvider as ServiceProvider;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider {
|
||||
|
@ -10,11 +10,12 @@ class RouteServiceProvider extends ServiceProvider {
|
|||
*
|
||||
* Register any model bindings or pattern based filters.
|
||||
*
|
||||
* @param UrlGenerator $url
|
||||
* @return void
|
||||
*/
|
||||
public function before()
|
||||
public function before(UrlGenerator $url)
|
||||
{
|
||||
URL::setRootControllerNamespace(
|
||||
$url->setRootControllerNamespace(
|
||||
trim(config('namespaces.controllers'), '\\')
|
||||
);
|
||||
}
|
||||
|
@ -26,7 +27,7 @@ public function before()
|
|||
*/
|
||||
public function map()
|
||||
{
|
||||
App::booted(function()
|
||||
$this->app->booted(function()
|
||||
{
|
||||
// Once the application has booted, we will include the default routes
|
||||
// file. This "namespace" helper will load the routes file within a
|
||||
|
|
Loading…
Reference in New Issue