Cachet/app/start/global.php

64 lines
2.0 KiB
PHP
Raw Normal View History

2014-11-16 22:26:08 +00:00
<?php
use Dingo\Api\Facade\API;
2015-01-01 22:11:22 +00:00
use Illuminate\Support\Facades\Log;
2014-11-16 22:26:08 +00:00
/*
|--------------------------------------------------------------------------
| Application Error Logger
|--------------------------------------------------------------------------
|
| 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.
|
*/
Log::useFiles(storage_path().'/logs/laravel.log');
/*
|--------------------------------------------------------------------------
| Application Error Handler
|--------------------------------------------------------------------------
|
| 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.
|
*/
2014-12-20 21:20:17 +00:00
App::error(function (Exception $exception, $code) {
Log::error($exception);
2014-11-16 22:26:08 +00:00
});
API::error(function (\Illuminate\Database\Eloquent\ModelNotFoundException $exception) {
2014-12-20 21:20:17 +00:00
return Response::make(['error' => $exception->getMessage()], 404);
});
2014-12-20 21:20:17 +00:00
App::missing(function ($exception) {
if (Request::is('dashboard*') or Request::is('api*')) {
return Response::view('errors.404', [
'pageTitle' => trans('cachet.dashboard.not_found_title'),
], 404);
}
return Redirect::route('status-page');
});
2014-11-16 22:26:08 +00:00
/*
|--------------------------------------------------------------------------
| Maintenance Mode Handler
|--------------------------------------------------------------------------
|
| The "down" Artisan command gives you the ability to put an application
| into maintenance mode. Here, you will define what is displayed back
| to the user if maintenance mode is in effect for the application.
|
*/
2014-12-20 21:20:17 +00:00
App::down(function () {
return Response::make("Be right back!", 503);
2014-11-16 22:26:08 +00:00
});