Preparing a SetupController

This commit is contained in:
James Brooks 2014-11-23 21:34:31 +00:00
parent 8d4bf3f5ea
commit e5a70aef0b
7 changed files with 99 additions and 81 deletions

View File

@ -0,0 +1,7 @@
<?php
class SetupController extends Controller {
public function showSetup() {
return View::make('setup');
}
}

View File

@ -1,26 +1,6 @@
<?php
/*
|--------------------------------------------------------------------------
| Application & Route Filters
|--------------------------------------------------------------------------
|
| Below you will find the "before" and "after" events for the application
| which may be used to do any work before or after a request into your
| application. Here you may also register your custom route filters.
|
*/
App::before(function($request)
{
//
});
App::after(function($request, $response)
{
//
});
Route::filter('no_setup', 'NoSetupFilter');
/*
|--------------------------------------------------------------------------

View File

@ -0,0 +1,10 @@
<?php
class NoSetupFilter {
public function filter($route, $request, $settingName) {
$setting = Setting::get($settingName);
if ($setting === null) {
return Response::make('Unauthorized', 401);
}
}
}

View File

@ -2,3 +2,7 @@
Route::get('/', 'HomeController@showIndex');
Route::get('/incident/{incident}', 'HomeController@showIncident');
Route::group(['before' => 'no_setup:app_name'], function() {
Route::get('/setup', 'SetupController@showSetup');
});

View File

@ -17,6 +17,7 @@ ClassLoader::addDirectories(array(
app_path().'/controllers',
app_path().'/models',
app_path().'/database/seeds',
app_path().'/filterss',
));

15
app/views/setup.blade.php Normal file
View File

@ -0,0 +1,15 @@
@extends('layout.master')
@section('content')
<div class='page-header'>
<ul class='list-group components'>
@foreach(Component::get() as $component)
<li class='list-group-item component '>
<!-- <span class='badge badge-{{ $component->color }}'><i class='glyphicon glyphicon-stop'></i></span> -->
<h4>{{ $component->name }} <small class='{{ $component->color }}'>{{ $component->humanStatus }}</small></h4>
<p>{{ $component->description }}</p>
</li>
@endforeach
</ul>
</div>
@stop

View File

@ -15,7 +15,8 @@
"app/models",
"app/database/migrations",
"app/database/seeds",
"app/tests/TestCase.php"
"app/tests/TestCase.php",
"app/filters"
]
},
"extra": {