From 0e0fd73b435d22aebb2efd2c42bf9df23d197b99 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Thu, 31 Jul 2014 15:13:50 -0500 Subject: [PATCH] Working on overall app structure. --- app/{console => commands}/.gitkeep | 0 app/commands/InspireCommand.php | 43 +++++++++++ app/config/app.php | 5 ++ app/{ => routing}/filters.php | 5 +- app/{ => routing}/routes.php | 13 ++++ app/src/Providers/AppServiceProvider.php | 27 +++++++ app/src/Providers/ArtisanServiceProvider.php | 45 +++++++++++ app/src/Providers/ErrorServiceProvider.php | 46 +++++++++++ app/src/Providers/LogServiceProvider.php | 41 ++++++++++ app/{models => src}/User.php | 0 app/start/artisan.php | 13 ---- app/start/global.php | 81 -------------------- app/start/local.php | 3 - bootstrap/autoload.php | 13 ---- composer.json | 4 +- 15 files changed, 226 insertions(+), 113 deletions(-) rename app/{console => commands}/.gitkeep (100%) create mode 100644 app/commands/InspireCommand.php rename app/{ => routing}/filters.php (96%) rename app/{ => routing}/routes.php (51%) create mode 100644 app/src/Providers/AppServiceProvider.php create mode 100644 app/src/Providers/ArtisanServiceProvider.php create mode 100644 app/src/Providers/ErrorServiceProvider.php create mode 100644 app/src/Providers/LogServiceProvider.php rename app/{models => src}/User.php (100%) delete mode 100644 app/start/artisan.php delete mode 100644 app/start/global.php delete mode 100644 app/start/local.php diff --git a/app/console/.gitkeep b/app/commands/.gitkeep similarity index 100% rename from app/console/.gitkeep rename to app/commands/.gitkeep diff --git a/app/commands/InspireCommand.php b/app/commands/InspireCommand.php new file mode 100644 index 000000000..4cbd600a4 --- /dev/null +++ b/app/commands/InspireCommand.php @@ -0,0 +1,43 @@ +comment('Inspiring Quote Here.'); + } + +} diff --git a/app/config/app.php b/app/config/app.php index 27665c606..4e5189019 100644 --- a/app/config/app.php +++ b/app/config/app.php @@ -95,6 +95,11 @@ return array( 'providers' => array( + 'AppServiceProvider', + 'ArtisanServiceProvider', + 'ErrorServiceProvider', + 'LogServiceProvider', + 'Illuminate\Foundation\Providers\ArtisanServiceProvider', 'Illuminate\Auth\AuthServiceProvider', 'Illuminate\Cache\CacheServiceProvider', diff --git a/app/filters.php b/app/routing/filters.php similarity index 96% rename from app/filters.php rename to app/routing/filters.php index fd0b4bcb6..908b99edf 100644 --- a/app/filters.php +++ b/app/routing/filters.php @@ -13,7 +13,10 @@ App::before(function($request) { - // + if (App::isDownForMaintenance()) + { + return Response::make('Be right back!'); + } }); diff --git a/app/routes.php b/app/routing/routes.php similarity index 51% rename from app/routes.php rename to app/routing/routes.php index 3e10dcf56..e25912273 100644 --- a/app/routes.php +++ b/app/routing/routes.php @@ -1,5 +1,18 @@ registerInspireCommand(); + + $this->commands('commands.inspire'); + } + + /** + * Register the Inspire Artisan command. + * + * @return void + */ + protected function registerInspireCommand() + { + // Each available Artisan command must be registered with the console so + // that it is available to be called. We'll register every command so + // the console gets access to each of the command object instances. + $this->app->bindShared('commands.inspire', function() + { + return new InspireCommand; + }); + } + +} \ No newline at end of file diff --git a/app/src/Providers/ErrorServiceProvider.php b/app/src/Providers/ErrorServiceProvider.php new file mode 100644 index 000000000..af5464e4b --- /dev/null +++ b/app/src/Providers/ErrorServiceProvider.php @@ -0,0 +1,46 @@ +setupErrorHandlers(); + } + + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + // + } + + /** + * Setup the error handlers for the application. + * + * @return void + */ + protected function setupErrorHandlers() + { + // 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. + + $this->app->error(function(Exception $exception, $code) + { + Log::error($exception); + }); + } + +} \ No newline at end of file diff --git a/app/src/Providers/LogServiceProvider.php b/app/src/Providers/LogServiceProvider.php new file mode 100644 index 000000000..3a0666a34 --- /dev/null +++ b/app/src/Providers/LogServiceProvider.php @@ -0,0 +1,41 @@ +setupLogging(); + } + + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + // + } + + /** + * Setup the logging facilities for the application. + * + * @return void + */ + protected function setupLogging() + { + // 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'); + } + +} \ No newline at end of file diff --git a/app/models/User.php b/app/src/User.php similarity index 100% rename from app/models/User.php rename to app/src/User.php diff --git a/app/start/artisan.php b/app/start/artisan.php deleted file mode 100644 index 1df850bc9..000000000 --- a/app/start/artisan.php +++ /dev/null @@ -1,13 +0,0 @@ -