#16 settings panel scaffolding

This commit is contained in:
Nabeel Shahzad 2017-06-20 18:49:45 -05:00
parent 11b3ec349b
commit c27a11ab21
13 changed files with 815 additions and 616 deletions

2
.gitignore vendored
View File

@ -38,6 +38,8 @@ tmp/
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
phpvms_next.iml
# Gradle:
.idea/**/gradle.xml
.idea/**/libraries

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectCodeStyleSettingsManager">
<option name="PER_PROJECT_SETTINGS">
<value />
</option>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default (1)" />
</component>
</project>

View File

@ -0,0 +1,6 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="AircraftTest" type="PHPUnitRunConfigurationType" factoryName="PHPUnit" singleton="true">
<TestRunner class="AircraftTest" configuration_file="$PROJECT_DIR$/phpunit.xml" file="$PROJECT_DIR$/tests/AircraftTest.php" scope="Class" use_alternative_configuration_file="true" />
<method />
</configuration>
</component>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="XtextAutoBuilderState">
<installedLanguages>xtend;xtext</installedLanguages>
<index>rO0ABXNyADtvcmcuZWNsaXBzZS54dGV4dC5yZXNvdXJjZS5pbXBsLkNodW5rZWRSZXNvdXJjZURlc2NyaXB0aW9uc4nX+GBmyGixDAAAeHB3BAAAAAB4</index>
<module2generated>rO0ABXNyABFqYXZhLnV0aWwuSGFzaE1hcAUH2sHDFmDRAwACRgAKbG9hZEZhY3RvckkACXRocmVzaG9sZHhwP0AAAAAAAAx3CAAAABAAAAAAeA==</module2generated>
</component>
</project>

View File

@ -17,11 +17,13 @@ build:
install: db
echo ""
reset:
-@rm database/testing.sqlite
clean:
@php artisan optimize
@php artisan route:clear
@php artisan config:clear
@rm -f database/testing.sqlite
reset: clean
@sqlite3 database/testing.sqlite ""
@php artisan migrate:refresh --seed --seeder DevelopmentSeeder

View File

@ -0,0 +1,41 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Models\Setting;
use App\Http\Requests;
use Redirect;
use Titan\Controllers\TitanAdminController;
use Illuminate\Http\Request;
class SettingsController extends BaseController
{
/**
* Display a listing of setting.
*
* @return Response
*/
public function index()
{
return $this->view('admins.settings.index')->with('items', Setting::all());
}
/**
* Update the specified setting in storage.
*
* @param Setting $setting
* @param Request $request
* @return Response
*/
public function update(Setting $setting, Request $request)
{
$this->validate($request, Setting::$rules, Setting::$messages);
$this->updateEntry($setting, $request->all());
return redirect("/admin/settings");
}
}

View File

@ -33,5 +33,9 @@ class AppServiceProvider extends ServiceProvider
$this->app->bind('App\Services\AircraftFareService', function($app) {
return new \App\Services\AircraftFareService();
});
if (in_array($this->app->environment(), ['local', 'dev', 'unittest'])) {
$this->app->register(\Bpocallaghan\Generators\GeneratorsServiceProvider::class);
}
}
}

View File

@ -8,6 +8,7 @@
"php": ">=7.0",
"laravel/framework": "5.4.*",
"barryvdh/laravel-ide-helper": "^2.1",
"yajra/laravel-datatables-oracle": "~6.0",
"infyomlabs/laravel-generator": "dev-master",
"laravelcollective/html": "5.4.x",
"infyomlabs/adminlte-templates": "5.3.x-dev",
@ -28,7 +29,8 @@
"phpunit/phpunit": "~5.7",
"symfony/css-selector": "3.1.*",
"symfony/dom-crawler": "3.1.*",
"laravel/homestead": "^5.4"
"laravel/homestead": "^5.4",
"bpocallaghan/generators": "^4.0"
},
"autoload": {
"classmap": [

1242
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,20 @@
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/vendor/bpocallaghan/generators" />
<excludeFolder url="file://$MODULE_DIR$/vendor/dompdf/dompdf" />
<excludeFolder url="file://$MODULE_DIR$/vendor/jeremeamia/SuperClosure" />
<excludeFolder url="file://$MODULE_DIR$/vendor/league/fractal" />
<excludeFolder url="file://$MODULE_DIR$/vendor/maatwebsite/excel" />
<excludeFolder url="file://$MODULE_DIR$/vendor/nikic/php-parser" />
<excludeFolder url="file://$MODULE_DIR$/vendor/phenx/php-font-lib" />
<excludeFolder url="file://$MODULE_DIR$/vendor/phenx/php-svg-lib" />
<excludeFolder url="file://$MODULE_DIR$/vendor/phpoffice/phpexcel" />
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/polyfill-php56" />
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/polyfill-util" />
<excludeFolder url="file://$MODULE_DIR$/vendor/yajra/laravel-datatables-oracle" />
</content>
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module-library">
<library name="PHARS">
@ -15,5 +28,40 @@
</SOURCES>
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="PHP" type="php">
<CLASSES>
<root url="file://$APPLICATION_HOME_DIR$/bin" />
<root url="file://$MODULE_DIR$/vendor/bpocallaghan/generators" />
<root url="file://$MODULE_DIR$/vendor/dompdf/dompdf" />
<root url="file://$MODULE_DIR$/vendor/jeremeamia/SuperClosure" />
<root url="file://$MODULE_DIR$/vendor/league/fractal" />
<root url="file://$MODULE_DIR$/vendor/maatwebsite/excel" />
<root url="file://$MODULE_DIR$/vendor/nikic/php-parser" />
<root url="file://$MODULE_DIR$/vendor/phenx/php-font-lib" />
<root url="file://$MODULE_DIR$/vendor/phenx/php-svg-lib" />
<root url="file://$MODULE_DIR$/vendor/phpoffice/phpexcel" />
<root url="file://$MODULE_DIR$/vendor/symfony/polyfill-php56" />
<root url="file://$MODULE_DIR$/vendor/symfony/polyfill-util" />
<root url="file://$MODULE_DIR$/vendor/yajra/laravel-datatables-oracle" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="file://$APPLICATION_HOME_DIR$/bin" />
<root url="file://$MODULE_DIR$/vendor/bpocallaghan/generators" />
<root url="file://$MODULE_DIR$/vendor/dompdf/dompdf" />
<root url="file://$MODULE_DIR$/vendor/jeremeamia/SuperClosure" />
<root url="file://$MODULE_DIR$/vendor/league/fractal" />
<root url="file://$MODULE_DIR$/vendor/maatwebsite/excel" />
<root url="file://$MODULE_DIR$/vendor/nikic/php-parser" />
<root url="file://$MODULE_DIR$/vendor/phenx/php-font-lib" />
<root url="file://$MODULE_DIR$/vendor/phenx/php-svg-lib" />
<root url="file://$MODULE_DIR$/vendor/phpoffice/phpexcel" />
<root url="file://$MODULE_DIR$/vendor/symfony/polyfill-php56" />
<root url="file://$MODULE_DIR$/vendor/symfony/polyfill-util" />
<root url="file://$MODULE_DIR$/vendor/yajra/laravel-datatables-oracle" />
</SOURCES>
</library>
</orderEntry>
</component>
</module>

View File

@ -0,0 +1,23 @@
@extends('admin.app')
@section('content')
<section class="content-header">
<h1 class="pull-left">Settings</h1>
{{--<h1 class="pull-right">
<a class="btn btn-primary pull-right" style="margin-top: -10px;margin-bottom: 5px" href="{!! route('admin.settings.create') !!}">Add New</a>
</h1>--}}
</section>
<div class="content">
<div class="clearfix"></div>
@include('flash::message')
<div class="clearfix"></div>
<div class="box box-primary">
<div class="box-body">
@include('admin.settings.table')
</div>
</div>
</div>
@endsection

View File

@ -0,0 +1,14 @@
<table class="table table-responsive" id="settings-table">
<thead>
<th>Name</th>
<th>Value</th>
</thead>
<tbody>
@foreach($settings as $s)
<tr>
<td>{!! $s->key !!}</td>
<td>{!! $s->value !!}</td>
</tr>
@endforeach
</tbody>
</table>

View File

@ -5,8 +5,7 @@ Route::get('/home', 'HomeController@index');
Route::group([
'namespace' => 'Frontend',
'as' => 'frontend.',
'namespace' => 'Frontend', 'prefix' => 'frontend', 'as' => 'frontend.',
'middleware' => ['role:admin|user'],
], function () {
Route::resource('dashboard', 'DashboardController');
@ -19,9 +18,7 @@ Auth::routes();
*/
Route::group([
'namespace' => 'Admin',
'prefix' => 'admin',
'as' => 'admin.',
'namespace' => 'Admin', 'prefix' => 'admin', 'as' => 'admin.',
'middleware' => ['role:admin'],
], function () {
Route::resource('airports', 'AirportController');
@ -29,16 +26,19 @@ Route::group([
Route::resource('aircraftclasses', 'AircraftClassController');
Route::resource('fares', 'FareController');
# aircraft and fare associations
Route::resource('aircraft', 'AircraftController');
Route::match(['get', 'post', 'put', 'delete'],
'aircraft/{id}/fares',
'AircraftController@fares');
Route::match(['get', 'post', 'put', 'delete'], 'aircraft/{id}/fares', 'AircraftController@fares');
# flights and aircraft associations
Route::resource('flights', 'FlightController');
Route::match(['get', 'post', 'put', 'delete'],
'flights/{id}/aircraft',
'FlightController@aircraft');
Route::match(['get', 'post', 'put', 'delete'], 'flights/{id}/aircraft', 'FlightController@aircraft');
# view/update settings
Route::match(['get'], 'settings', 'SettingsController@index');
Route::match(['post', 'put'], 'settings', 'SettingsController@update');
# defaults
Route::get('', ['uses' => 'DashboardController@index']);
Route::get('/', ['uses' => 'DashboardController@index']);
Route::get('/dashboard', ['uses' => 'DashboardController@index','name' => 'dashboard']);