mirror of
https://github.com/laravel/laravel.git
synced 2025-02-20 11:53:14 +08:00
Use facades.
This commit is contained in:
parent
2ab3d52540
commit
838b20d4a0
@ -1,5 +1,7 @@
|
||||
<?php namespace App\Providers;
|
||||
|
||||
use App, Log;
|
||||
use Exception;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class ErrorServiceProvider extends ServiceProvider {
|
||||
@ -17,9 +19,9 @@ class ErrorServiceProvider extends ServiceProvider {
|
||||
// exceptions. If nothing is returned, the default error view is
|
||||
// shown, which includes a detailed stack trace during debug.
|
||||
|
||||
$this->app->error(function(\Exception $exception, $code)
|
||||
App::error(function(Exception $exception, $code)
|
||||
{
|
||||
$this->app['log']->error($exception);
|
||||
Log::error($exception);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
<?php namespace App\Providers;
|
||||
|
||||
use Log;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class LogServiceProvider extends ServiceProvider {
|
||||
@ -11,13 +12,7 @@ class LogServiceProvider extends ServiceProvider {
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
// Here we will configure the error logger setup for the application which
|
||||
// is built on top of the wonderful Monolog library. By default we will
|
||||
// build a basic log file setup which creates a single file for logs.
|
||||
|
||||
$this->app['log']->useFiles(
|
||||
storage_path().'/logs/laravel.log'
|
||||
);
|
||||
Log::useFiles(storage_path().'/logs/laravel.log');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,6 @@
|
||||
<?php namespace App\Providers;
|
||||
|
||||
use App;
|
||||
use Illuminate\Routing\RouteServiceProvider as ServiceProvider;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider {
|
||||
@ -23,7 +24,7 @@ class RouteServiceProvider extends ServiceProvider {
|
||||
*/
|
||||
public function map()
|
||||
{
|
||||
$this->app->booted(function()
|
||||
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
|
||||
@ -31,7 +32,7 @@ class RouteServiceProvider extends ServiceProvider {
|
||||
|
||||
$this->namespaced(function()
|
||||
{
|
||||
require app('path').'/Http/routes.php';
|
||||
require app_path().'/Http/routes.php';
|
||||
});
|
||||
});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user