Skip to content

Commit 0e0fd73

Browse files
committed
Working on overall app structure.
1 parent a500135 commit 0e0fd73

15 files changed

+226
-113
lines changed
File renamed without changes.

app/commands/InspireCommand.php

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
3+
use Illuminate\Console\Command;
4+
use Symfony\Component\Console\Input\InputOption;
5+
use Symfony\Component\Console\Input\InputArgument;
6+
7+
class InspireCommand extends Command {
8+
9+
/**
10+
* The console command name.
11+
*
12+
* @var string
13+
*/
14+
protected $name = 'inspire';
15+
16+
/**
17+
* The console command description.
18+
*
19+
* @var string
20+
*/
21+
protected $description = 'Display an inpiring quote..';
22+
23+
/**
24+
* Create a new command instance.
25+
*
26+
* @return void
27+
*/
28+
public function __construct()
29+
{
30+
parent::__construct();
31+
}
32+
33+
/**
34+
* Execute the console command.
35+
*
36+
* @return mixed
37+
*/
38+
public function fire()
39+
{
40+
$this->comment('Inspiring Quote Here.');
41+
}
42+
43+
}

app/config/app.php

+5
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@
9595

9696
'providers' => array(
9797

98+
'AppServiceProvider',
99+
'ArtisanServiceProvider',
100+
'ErrorServiceProvider',
101+
'LogServiceProvider',
102+
98103
'Illuminate\Foundation\Providers\ArtisanServiceProvider',
99104
'Illuminate\Auth\AuthServiceProvider',
100105
'Illuminate\Cache\CacheServiceProvider',

app/filters.php renamed to app/routing/filters.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@
1313

1414
App::before(function($request)
1515
{
16-
//
16+
if (App::isDownForMaintenance())
17+
{
18+
return Response::make('Be right back!');
19+
}
1720
});
1821

1922

app/routes.php renamed to app/routing/routes.php

+13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
<?php
22

3+
/*
4+
|--------------------------------------------------------------------------
5+
| Require The Filters File
6+
|--------------------------------------------------------------------------
7+
|
8+
| Next we will load the filters file for the application. This gives us
9+
| a nice separate location to store our route and application filter
10+
| definitions instead of putting them all in the main routes file.
11+
|
12+
*/
13+
14+
require __DIR__.'/filters.php';
15+
316
/*
417
|--------------------------------------------------------------------------
518
| Application Routes
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
use Illuminate\Support\ServiceProvider;
4+
5+
class AppServiceProvider extends ServiceProvider {
6+
7+
/**
8+
* Bootstrap the application events.
9+
*
10+
* @return void
11+
*/
12+
public function boot()
13+
{
14+
//
15+
}
16+
17+
/**
18+
* Register the service provider.
19+
*
20+
* @return void
21+
*/
22+
public function register()
23+
{
24+
//
25+
}
26+
27+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
3+
use Illuminate\Support\ServiceProvider;
4+
5+
class ArtisanServiceProvider extends ServiceProvider {
6+
7+
/**
8+
* Bootstrap the application events.
9+
*
10+
* @return void
11+
*/
12+
public function boot()
13+
{
14+
//
15+
}
16+
17+
/**
18+
* Register the service provider.
19+
*
20+
* @return void
21+
*/
22+
public function register()
23+
{
24+
$this->registerInspireCommand();
25+
26+
$this->commands('commands.inspire');
27+
}
28+
29+
/**
30+
* Register the Inspire Artisan command.
31+
*
32+
* @return void
33+
*/
34+
protected function registerInspireCommand()
35+
{
36+
// Each available Artisan command must be registered with the console so
37+
// that it is available to be called. We'll register every command so
38+
// the console gets access to each of the command object instances.
39+
$this->app->bindShared('commands.inspire', function()
40+
{
41+
return new InspireCommand;
42+
});
43+
}
44+
45+
}
+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php
2+
3+
use Illuminate\Support\ServiceProvider;
4+
5+
class ErrorServiceProvider extends ServiceProvider {
6+
7+
/**
8+
* Bootstrap the application events.
9+
*
10+
* @return void
11+
*/
12+
public function boot()
13+
{
14+
$this->setupErrorHandlers();
15+
}
16+
17+
/**
18+
* Register the service provider.
19+
*
20+
* @return void
21+
*/
22+
public function register()
23+
{
24+
//
25+
}
26+
27+
/**
28+
* Setup the error handlers for the application.
29+
*
30+
* @return void
31+
*/
32+
protected function setupErrorHandlers()
33+
{
34+
// Here you may handle any errors that occur in your application, including
35+
// logging them or displaying custom views for specific errors. You may
36+
// even register several error handlers to handle different types of
37+
// exceptions. If nothing is returned, the default error view is
38+
// shown, which includes a detailed stack trace during debug.
39+
40+
$this->app->error(function(Exception $exception, $code)
41+
{
42+
Log::error($exception);
43+
});
44+
}
45+
46+
}
+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
3+
use Illuminate\Support\ServiceProvider;
4+
5+
class LogServiceProvider extends ServiceProvider {
6+
7+
/**
8+
* Bootstrap the application events.
9+
*
10+
* @return void
11+
*/
12+
public function boot()
13+
{
14+
$this->setupLogging();
15+
}
16+
17+
/**
18+
* Register the service provider.
19+
*
20+
* @return void
21+
*/
22+
public function register()
23+
{
24+
//
25+
}
26+
27+
/**
28+
* Setup the logging facilities for the application.
29+
*
30+
* @return void
31+
*/
32+
protected function setupLogging()
33+
{
34+
// Here we will configure the error logger setup for the application which
35+
// is built on top of the wonderful Monolog library. By default we will
36+
// build a basic log file setup which creates a single file for logs.
37+
38+
Log::useFiles(storage_path().'/logs/laravel.log');
39+
}
40+
41+
}
File renamed without changes.

app/start/artisan.php

-13
This file was deleted.

app/start/global.php

-81
This file was deleted.

app/start/local.php

-3
This file was deleted.

bootstrap/autoload.php

-13
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,6 @@
3232
require $compiled;
3333
}
3434

35-
/*
36-
|--------------------------------------------------------------------------
37-
| Setup Patchwork UTF-8 Handling
38-
|--------------------------------------------------------------------------
39-
|
40-
| The Patchwork library provides solid handling of UTF-8 strings as well
41-
| as provides replacements for all mb_* and iconv type functions that
42-
| are not available by default in PHP. We'll setup this stuff here.
43-
|
44-
*/
45-
46-
Patchwork\Utf8\Bootup::initMbstring();
47-
4835
/*
4936
|--------------------------------------------------------------------------
5037
| Register The Laravel Auto Loader

composer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
},
99
"autoload": {
1010
"classmap": [
11-
"app/console",
11+
"app/commands",
1212
"app/controllers",
13-
"app/models",
1413
"app/database/migrations",
1514
"app/database/seeds",
15+
"app/src",
1616
"app/tests/TestCase.php"
1717
]
1818
},

0 commit comments

Comments
 (0)