Working on a few changes.

This commit is contained in:
Taylor Otwell 2014-08-27 12:49:50 +02:00
parent fdba65c0dc
commit 78c932f688
6 changed files with 12 additions and 40 deletions

View File

@ -1,17 +1,20 @@
<?php namespace App\Providers;
use App, Log;
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
@ -19,9 +22,9 @@ public function boot()
// exceptions. If nothing is returned, the default error view is
// shown, which includes a detailed stack trace during debug.
App::error(function(Exception $exception, $code)
$handler->error(function(Exception $e, $code) use ($log)
{
Log::error($exception);
$log->error($e);
});
}

View File

@ -1,29 +0,0 @@
<?php namespace App\Providers;
use Illuminate\Foundation\Providers\EventServiceProvider as ServiceProvider;
class EventServiceProvider extends ServiceProvider {
/**
* Bootstrap the application events.
*
* @return void
*/
public function boot()
{
//
}
/**
* Get the directories to scan for events.
*
* @return array
*/
public function scan()
{
return [
app_path(),
];
}
}

View File

@ -1,6 +1,6 @@
<?php namespace App\Providers;
use Log;
use Illuminate\Contracts\Logging\Log;
use Illuminate\Support\ServiceProvider;
class LogServiceProvider extends ServiceProvider {
@ -8,11 +8,12 @@ class LogServiceProvider extends ServiceProvider {
/**
* Configure the application's logging facilities.
*
* @param Log $log
* @return void
*/
public function boot()
public function boot(Log $log)
{
Log::useFiles(storage_path().'/logs/laravel.log');
$log->useFiles(storage_path().'/logs/laravel.log');
}
/**

View File

@ -1,6 +1,5 @@
<?php namespace App\Providers;
use App;
use Illuminate\Routing\RouteServiceProvider as ServiceProvider;
class RouteServiceProvider extends ServiceProvider {
@ -24,7 +23,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

View File

@ -101,7 +101,6 @@
'App\Providers\AppServiceProvider',
'App\Providers\ArtisanServiceProvider',
'App\Providers\ErrorServiceProvider',
'App\Providers\EventServiceProvider',
'App\Providers\FilterServiceProvider',
'App\Providers\LogServiceProvider',
'App\Providers\RouteServiceProvider',

View File

@ -18,7 +18,6 @@
__DIR__.'/../app/Providers/AppServiceProvider.php',
__DIR__.'/../app/Providers/ArtisanServiceProvider.php',
__DIR__.'/../app/Providers/ErrorServiceProvider.php',
__DIR__.'/../app/Providers/EventServiceProvider.php',
__DIR__.'/../app/Providers/FilterServiceProvider.php',
__DIR__.'/../app/Providers/LogServiceProvider.php',
__DIR__.'/../app/Providers/RouteServiceProvider.php',