1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 15:13:29 +01:00
invoiceninja/app/start/global.php

99 lines
2.9 KiB
PHP
Raw Normal View History

2013-11-26 13:45:07 +01:00
<?php
/*
|--------------------------------------------------------------------------
| Register The Laravel Class Loader
|--------------------------------------------------------------------------
|
| In addition to using Composer, you may use the Laravel class loader to
| load your controllers and models. This is useful for keeping all of
| your classes in the "global" namespace without Composer updating.
|
*/
ClassLoader::addDirectories(array(
app_path().'/commands',
app_path().'/controllers',
app_path().'/models',
app_path().'/database/seeds',
2013-11-29 13:09:21 +01:00
app_path().'/libraries',
2013-12-15 13:55:50 +01:00
app_path().'/handlers',
2013-11-26 13:45:07 +01: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 rotating log file setup which creates a new file each day.
|
*/
2014-01-05 17:44:49 +01:00
Log::useFiles(storage_path().'/logs/laravel.log');
2013-11-26 13:45:07 +01:00
2014-01-05 17:44:49 +01:00
/*
use Monolog\Logger;
$monolog = Log::getMonolog();
$monolog->pushHandler(new Monolog\Handler\SyslogHandler('intranet', 'user', Logger::DEBUG, false, LOG_PID));
2014-01-05 17:44:49 +01:00
*/
2013-11-26 13:45:07 +01:00
/*
|--------------------------------------------------------------------------
| 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.
|
*/
App::error(function(Exception $exception, $code)
{
2014-01-09 00:22:56 +01:00
Utils::logError($exception . ' ' . $code);
2014-06-02 18:21:47 +02:00
return Response::view('error', ['error' => "A {$code} error occurred."], $code);
2013-11-26 13:45:07 +01: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 maintenace mode is in effect for this application.
|
*/
App::down(function()
{
return Response::make("Be right back!", 503);
});
2013-12-15 13:55:50 +01:00
Event::subscribe('UserEventHandler');
2013-12-25 22:34:42 +01:00
Event::subscribe('InvoiceEventHandler');
2013-12-15 13:55:50 +01:00
2013-11-26 13:45:07 +01:00
/*
|--------------------------------------------------------------------------
| Require The Filters File
|--------------------------------------------------------------------------
|
| Next we will load the filters file for the application. This gives us
| a nice separate location to store our route and application filter
| definitions instead of putting them all in the main routes file.
|
*/
require app_path().'/filters.php';