add airports table and #7 integrate permissions
This commit is contained in:
parent
35f660d1d9
commit
d3cf57a1d1
@ -12,5 +12,3 @@ DB_USERNAME=
|
||||
DB_PASSWORD=
|
||||
|
||||
CACHE_DRIVER=array
|
||||
SESSION_DRIVER=array
|
||||
QUEUE_DRIVER=sync
|
||||
|
18
Makefile
18
Makefile
@ -10,24 +10,30 @@ all: build
|
||||
|
||||
build:
|
||||
composer install --no-interaction
|
||||
php artisan optimize
|
||||
php artisan config:cache
|
||||
@make db
|
||||
|
||||
install:
|
||||
install: db
|
||||
echo ""
|
||||
|
||||
reset:
|
||||
@rm database/testing.sqlite
|
||||
@php artisan optimize
|
||||
@php artisan config:clear
|
||||
@sqlite3 database/testing.sqlite ""
|
||||
@php artisan migrate:refresh --seed
|
||||
|
||||
db:
|
||||
sqlite3 database/testing.sqlite ""
|
||||
php artisan migrate
|
||||
php artisan db:seed
|
||||
|
||||
unittest-db:
|
||||
rm -f database/unittest.sqlite
|
||||
sqlite3 database/unittest.sqlite ""
|
||||
php artisan migrate:refresh --seed --env unittest
|
||||
|
||||
reset-db:
|
||||
rm database/testing.sqlite
|
||||
make db
|
||||
|
||||
tests: test
|
||||
|
||||
test:
|
||||
@ -35,7 +41,7 @@ test:
|
||||
|
||||
schema:
|
||||
#php artisan infyom:scaffold Airlines --fieldsFile=database/schema/airlines.json
|
||||
php artisan infyom:scaffold Aircraft --fieldsFile=database/schema/aircraft.json
|
||||
#php artisan infyom:scaffold Aircraft --fieldsFile=database/schema/aircraft.json
|
||||
echo ""
|
||||
|
||||
docker:
|
||||
|
@ -13,6 +13,7 @@ run the following commands. for right now, we're running on sqlite. for mysql, s
|
||||
```bash
|
||||
cp .env.example .env
|
||||
composer install --no-interaction
|
||||
php artisan optimize
|
||||
sqlite3 database/testing.sqlite ""
|
||||
php artisan migrate:refresh --seed
|
||||
```
|
||||
|
156
app/Http/Controllers/Admin/AirportController.php
Normal file
156
app/Http/Controllers/Admin/AirportController.php
Normal file
@ -0,0 +1,156 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Requests;
|
||||
use App\Http\Requests\CreateAirportRequest;
|
||||
use App\Http\Requests\UpdateAirportRequest;
|
||||
use App\Repositories\AirportRepository;
|
||||
use App\Http\Controllers\AppBaseController as InfyOmBaseController;
|
||||
use Illuminate\Http\Request;
|
||||
use Flash;
|
||||
use Prettus\Repository\Criteria\RequestCriteria;
|
||||
use Response;
|
||||
|
||||
class AirportController extends InfyOmBaseController
|
||||
{
|
||||
/** @var AirportRepository */
|
||||
private $airportRepository;
|
||||
|
||||
public function __construct(AirportRepository $airportRepo)
|
||||
{
|
||||
$this->airportRepository = $airportRepo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the Airport.
|
||||
*
|
||||
* @param Request $request
|
||||
* @return Response
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
$this->airportRepository->pushCriteria(new RequestCriteria($request));
|
||||
$airports = $this->airportRepository->all();
|
||||
|
||||
return view('admin.airports.index')
|
||||
->with('airports', $airports);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new Airport.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('admin.airports.create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created Airport in storage.
|
||||
*
|
||||
* @param CreateAirportRequest $request
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function store(CreateAirportRequest $request)
|
||||
{
|
||||
$input = $request->all();
|
||||
|
||||
$airport = $this->airportRepository->create($input);
|
||||
|
||||
Flash::success('Airport saved successfully.');
|
||||
|
||||
return redirect(route('admin.airports.index'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified Airport.
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
$airport = $this->airportRepository->findWithoutFail($id);
|
||||
|
||||
if (empty($airport)) {
|
||||
Flash::error('Airport not found');
|
||||
|
||||
return redirect(route('admin.airports.index'));
|
||||
}
|
||||
|
||||
return view('admin.airports.show')->with('airport', $airport);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified Airport.
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$airport = $this->airportRepository->findWithoutFail($id);
|
||||
|
||||
if (empty($airport)) {
|
||||
Flash::error('Airport not found');
|
||||
|
||||
return redirect(route('admin.airports.index'));
|
||||
}
|
||||
|
||||
return view('admin.airports.edit')->with('airport', $airport);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified Airport in storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @param UpdateAirportRequest $request
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function update($id, UpdateAirportRequest $request)
|
||||
{
|
||||
$airport = $this->airportRepository->findWithoutFail($id);
|
||||
|
||||
if (empty($airport)) {
|
||||
Flash::error('Airport not found');
|
||||
|
||||
return redirect(route('admin.airports.index'));
|
||||
}
|
||||
|
||||
$airport = $this->airportRepository->update($request->all(), $id);
|
||||
|
||||
Flash::success('Airport updated successfully.');
|
||||
|
||||
return redirect(route('admin.airports.index'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified Airport from storage.
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
$airport = $this->airportRepository->findWithoutFail($id);
|
||||
|
||||
if (empty($airport)) {
|
||||
Flash::error('Airport not found');
|
||||
|
||||
return redirect(route('admin.airports.index'));
|
||||
}
|
||||
|
||||
$this->airportRepository->delete($id);
|
||||
|
||||
Flash::success('Airport deleted successfully.');
|
||||
|
||||
return redirect(route('admin.airports.index'));
|
||||
}
|
||||
}
|
@ -2,8 +2,9 @@
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\User;
|
||||
use Validator;
|
||||
use App\Models\Role;
|
||||
use App\Models\User;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Foundation\Auth\RegistersUsers;
|
||||
|
||||
@ -50,7 +51,7 @@ class RegisterController extends Controller
|
||||
return Validator::make($data, [
|
||||
'name' => 'required|max:255',
|
||||
'email' => 'required|email|max:255|unique:users',
|
||||
'password' => 'required|min:6|confirmed',
|
||||
'password' => 'required|min:5|confirmed',
|
||||
]);
|
||||
}
|
||||
|
||||
@ -62,10 +63,14 @@ class RegisterController extends Controller
|
||||
*/
|
||||
protected function create(array $data)
|
||||
{
|
||||
return User::create([
|
||||
$user = User::create([
|
||||
'name' => $data['name'],
|
||||
'email' => $data['email'],
|
||||
'password' => bcrypt($data['password']),
|
||||
]);
|
||||
|
||||
$role = Role::where('name', 'admin')->first();
|
||||
$user->attachRole($role);
|
||||
return $user->refresh();
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,9 @@
|
||||
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
class BaseController extends Controller
|
||||
use App\Http\Controllers\AppBaseController;
|
||||
|
||||
class BaseController extends AppBaseController
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -11,6 +11,6 @@ class DashboardController extends BaseController
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view('frontend/dashboard');
|
||||
return view('frontend.dashboard');
|
||||
}
|
||||
}
|
||||
|
30
app/Http/Requests/CreateAirportRequest.php
Normal file
30
app/Http/Requests/CreateAirportRequest.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
use App\Models\Airport;
|
||||
|
||||
class CreateAirportRequest extends Request
|
||||
{
|
||||
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return Airport::$rules;
|
||||
}
|
||||
}
|
30
app/Http/Requests/UpdateAirportRequest.php
Normal file
30
app/Http/Requests/UpdateAirportRequest.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
use App\Models\Airport;
|
||||
|
||||
class UpdateAirportRequest extends Request
|
||||
{
|
||||
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return Airport::$rules;
|
||||
}
|
||||
}
|
52
app/Models/Airport.php
Normal file
52
app/Models/Airport.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Eloquent as Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
* Class Airport
|
||||
* @package App\Models
|
||||
*/
|
||||
class Airport extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
public $table = 'airports';
|
||||
|
||||
|
||||
protected $dates = ['deleted_at'];
|
||||
|
||||
|
||||
public $fillable = [
|
||||
'icao'
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be casted to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
|
||||
];
|
||||
|
||||
/**
|
||||
* Validation rules
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $rules = [
|
||||
'icao' => 'required'
|
||||
];
|
||||
|
||||
public function save(array $options = [])
|
||||
{
|
||||
if(in_array('icao', $options)) {
|
||||
$options['icao'] = strtoupper($options['icao']);
|
||||
}
|
||||
|
||||
return parent::save($options);
|
||||
}
|
||||
}
|
24
app/Repositories/AirportRepository.php
Normal file
24
app/Repositories/AirportRepository.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories;
|
||||
|
||||
use App\Models\Airport;
|
||||
use InfyOm\Generator\Common\BaseRepository;
|
||||
|
||||
class AirportRepository extends BaseRepository
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $fieldSearchable = [
|
||||
'icao'
|
||||
];
|
||||
|
||||
/**
|
||||
* Configure the Model
|
||||
**/
|
||||
public function model()
|
||||
{
|
||||
return Airport::class;
|
||||
}
|
||||
}
|
@ -86,6 +86,6 @@ return [
|
||||
|
|
||||
*/
|
||||
|
||||
'prefix' => 'laravel',
|
||||
'prefix' => 'phpvms',
|
||||
|
||||
];
|
||||
|
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class CreateAirportsTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('airports', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('icao', 5)->unique();
|
||||
$table->string('name');
|
||||
$table->string('location')->nullable();
|
||||
$table->float('lat', 7, 4)->default(0.0);
|
||||
$table->float('lon', 7, 4)->default(0.0);
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('airports');
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
@ -11,6 +12,61 @@ class DatabaseSeeder extends Seeder
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
// $this->call(AircraftClassesSeeder::class);
|
||||
$this->user_seeder();
|
||||
$this->airport_seeder();
|
||||
}
|
||||
|
||||
protected function time() {
|
||||
return Carbon::now()->format('Y-m-d H:i:s');
|
||||
}
|
||||
/**
|
||||
* Add an initial admin user and roles
|
||||
*/
|
||||
protected function user_seeder()
|
||||
{
|
||||
foreach ([
|
||||
['id' => 1,'name' => 'admin', 'display_name' => 'Administrators'],
|
||||
['id' => 2, 'name' => 'user', 'display_name' => 'Pilot'],
|
||||
] as $group) { DB::table('roles')->insert($group); }
|
||||
|
||||
DB::table('users')->insert([
|
||||
'id' => 1,
|
||||
'name' => 'Admin User',
|
||||
'email' => 'admin@phpvms.net',
|
||||
'password' => bcrypt('phpvms'),
|
||||
'created_at' => Carbon::now('UTC'),
|
||||
'updated_at' => Carbon::now('UTC'),
|
||||
]);
|
||||
|
||||
// add as both admin and user role
|
||||
DB::table('role_user')->insert(['user_id' => 1, 'role_id' => 1]);
|
||||
DB::table('role_user')->insert(['user_id' => 1, 'role_id' => 2]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a few initial airports
|
||||
*/
|
||||
protected function airport_seeder()
|
||||
{
|
||||
$airports = [
|
||||
[
|
||||
'icao' => 'KAUS',
|
||||
'name' => 'Austin-Bergstrom International Airport',
|
||||
'location' => 'Austin, Texas, USA',
|
||||
'lat' => 30.1945278,
|
||||
'lon' => -97.6698889,
|
||||
],
|
||||
[
|
||||
'icao' => 'KJFK',
|
||||
'name' => 'John F Kennedy International Airport',
|
||||
'location' => 'New York, New York, USA',
|
||||
'lat' => 40.6399257,
|
||||
'lon' => -73.7786950,
|
||||
],
|
||||
];
|
||||
|
||||
foreach($airports as $airport) {
|
||||
DB::table('airports')->insert($airport);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,39 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class InitialDataSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$this->user_seeder();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an initial admin user and roles
|
||||
*/
|
||||
protected function user_seeder()
|
||||
{
|
||||
foreach ([
|
||||
['id' => 1,'name' => 'admin', 'display_name' => 'Administrators'],
|
||||
['id' => 2, 'name' => 'user', 'display_name' => 'Pilot'],
|
||||
] as $group) { DB::table('roles')->insert($group); }
|
||||
|
||||
DB::table('users')->insert([
|
||||
'id' => 1,
|
||||
'name' => 'Admin User',
|
||||
'email' => 'admin@phpvms.net',
|
||||
'password' => bcrypt('admin'),
|
||||
]);
|
||||
|
||||
DB::table('role_user')->insert([
|
||||
'user_id' => 1,
|
||||
'role_id' => 1,
|
||||
]);
|
||||
}
|
||||
}
|
22
resources/views/admin/airports/create.blade.php
Normal file
22
resources/views/admin/airports/create.blade.php
Normal file
@ -0,0 +1,22 @@
|
||||
@extends('admin.app')
|
||||
|
||||
@section('content')
|
||||
<section class="content-header">
|
||||
<h1>Add Airport</h1>
|
||||
</section>
|
||||
<div class="content">
|
||||
@include('adminlte-templates::common.errors')
|
||||
<div class="box box-primary">
|
||||
|
||||
<div class="box-body">
|
||||
<div class="row">
|
||||
{!! Form::open(['route' => 'admin.airports.store']) !!}
|
||||
|
||||
@include('admin.airports.fields')
|
||||
|
||||
{!! Form::close() !!}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
23
resources/views/admin/airports/edit.blade.php
Normal file
23
resources/views/admin/airports/edit.blade.php
Normal file
@ -0,0 +1,23 @@
|
||||
@extends('admin.app')
|
||||
|
||||
@section('content')
|
||||
<section class="content-header">
|
||||
<h1>
|
||||
Editing {{ $airport->name }}
|
||||
</h1>
|
||||
</section>
|
||||
<div class="content">
|
||||
@include('adminlte-templates::common.errors')
|
||||
<div class="box box-primary">
|
||||
<div class="box-body">
|
||||
<div class="row">
|
||||
{!! Form::model($airport, ['route' => ['admin.airports.update', $airport->id], 'method' => 'patch']) !!}
|
||||
|
||||
@include('admin.airports.fields')
|
||||
|
||||
{!! Form::close() !!}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
31
resources/views/admin/airports/fields.blade.php
Normal file
31
resources/views/admin/airports/fields.blade.php
Normal file
@ -0,0 +1,31 @@
|
||||
<!-- Icao Field -->
|
||||
<div class="form-group col-sm-6">
|
||||
{!! Form::label('icao', 'ICAO:') !!}
|
||||
{!! Form::text('icao', null, ['class' => 'form-control']) !!}
|
||||
</div>
|
||||
|
||||
<div class="form-group col-sm-6">
|
||||
{!! Form::label('name', 'Name:') !!}
|
||||
{!! Form::text('name', null, ['class' => 'form-control']) !!}
|
||||
</div>
|
||||
|
||||
<div class="form-group col-sm-6">
|
||||
{!! Form::label('location', 'Location:') !!}
|
||||
{!! Form::text('location', null, ['class' => 'form-control']) !!}
|
||||
</div>
|
||||
|
||||
<div class="form-group col-sm-6">
|
||||
{!! Form::label('lat', 'Latitude:') !!}
|
||||
{!! Form::number('lat', null, ['class' => 'form-control']) !!}
|
||||
</div>
|
||||
|
||||
<div class="form-group col-sm-6">
|
||||
{!! Form::label('lon', 'Longitude:') !!}
|
||||
{!! Form::number('lon', null, ['class' => 'form-control']) !!}
|
||||
</div>
|
||||
|
||||
<!-- Submit Field -->
|
||||
<div class="form-group col-sm-12">
|
||||
{!! Form::submit('Save', ['class' => 'btn btn-primary']) !!}
|
||||
<a href="{!! route('admin.airports.index') !!}" class="btn btn-default">Cancel</a>
|
||||
</div>
|
23
resources/views/admin/airports/index.blade.php
Normal file
23
resources/views/admin/airports/index.blade.php
Normal file
@ -0,0 +1,23 @@
|
||||
@extends('admin.app')
|
||||
|
||||
@section('content')
|
||||
<section class="content-header">
|
||||
<h1 class="pull-left">$MODEL_NAME_PLURAL_HUMAN$</h1>
|
||||
<h1 class="pull-right">
|
||||
<a class="btn btn-primary pull-right" style="margin-top: -10px;margin-bottom: 5px" href="{!! route('admin.airports.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.airports.table')
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
19
resources/views/admin/airports/show.blade.php
Normal file
19
resources/views/admin/airports/show.blade.php
Normal file
@ -0,0 +1,19 @@
|
||||
@extends('admin.app')
|
||||
|
||||
@section('content')
|
||||
<section class="content-header">
|
||||
<h1>
|
||||
{!! $airport->name !!}
|
||||
</h1>
|
||||
</section>
|
||||
<div class="content">
|
||||
<div class="box box-primary">
|
||||
<div class="box-body">
|
||||
<div class="row" style="padding-left: 20px">
|
||||
@include('admin.airports.show_fields')
|
||||
<a href="{!! route('admin.airports.index') !!}" class="btn btn-default">Back</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
38
resources/views/admin/airports/show_fields.blade.php
Normal file
38
resources/views/admin/airports/show_fields.blade.php
Normal file
@ -0,0 +1,38 @@
|
||||
<!-- Icao Field -->
|
||||
<div class="form-group">
|
||||
{!! Form::label('icao', 'ICAO:') !!}
|
||||
<p>{!! $airport->icao !!}</p>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
{!! Form::label('name', 'Name:') !!}
|
||||
<p>{!! $airport->name !!}</p>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
{!! Form::label('location', 'Location:') !!}
|
||||
<p>{!! $airport->location !!}</p>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
{!! Form::label('lat', 'Latitude:') !!}
|
||||
<p>{!! $airport->lat !!}</p>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
{!! Form::label('lon', 'Longitude:') !!}
|
||||
<p>{!! $airport->lon !!}</p>
|
||||
</div>
|
||||
|
||||
<!-- Created At Field -->
|
||||
<div class="form-group">
|
||||
{!! Form::label('created_at', 'Created At:') !!}
|
||||
<p>{!! $airport->created_at !!}</p>
|
||||
</div>
|
||||
|
||||
<!-- Updated At Field -->
|
||||
<div class="form-group">
|
||||
{!! Form::label('updated_at', 'Updated At:') !!}
|
||||
<p>{!! $airport->updated_at !!}</p>
|
||||
</div>
|
||||
|
26
resources/views/admin/airports/table.blade.php
Normal file
26
resources/views/admin/airports/table.blade.php
Normal file
@ -0,0 +1,26 @@
|
||||
<table class="table table-responsive" id="airports-table">
|
||||
<thead>
|
||||
<th>ICAO</th>
|
||||
<th>Name</th>
|
||||
<th>Location</th>
|
||||
<th colspan="3">Action</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($airports as $airport)
|
||||
<tr>
|
||||
<td>{!! $airport->icao !!}</td>
|
||||
<td>{!! $airport->name !!}</td>
|
||||
<td>{!! $airport->location !!} ({!! $airport->lat !!}x{!! $airport->lon !!})</td>
|
||||
<td>
|
||||
{!! Form::open(['route' => ['admin.airports.destroy', $airport->id], 'method' => 'delete']) !!}
|
||||
<div class='btn-group'>
|
||||
<a href="{!! route('admin.airports.show', [$airport->id]) !!}" class='btn btn-default btn-xs'><i class="glyphicon glyphicon-eye-open"></i></a>
|
||||
<a href="{!! route('admin.airports.edit', [$airport->id]) !!}" class='btn btn-default btn-xs'><i class="glyphicon glyphicon-edit"></i></a>
|
||||
{!! Form::button('<i class="glyphicon glyphicon-trash"></i>', ['type' => 'submit', 'class' => 'btn btn-danger btn-xs', 'onclick' => "return confirm('Are you sure?')"]) !!}
|
||||
</div>
|
||||
{!! Form::close() !!}
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
@ -0,0 +1,20 @@
|
||||
@extends('admin.app')
|
||||
|
||||
@section('content')
|
||||
<section class="content-header">
|
||||
<h1 class="pull-left">Dashboard</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">
|
||||
wassup
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
@ -3,18 +3,19 @@
|
||||
* Admin routes
|
||||
*/
|
||||
|
||||
Route::get('/admin', [
|
||||
/*Route::get('/admin', [
|
||||
'middleware' => ['role:admin'],
|
||||
'uses' => 'DashboardController@index'
|
||||
'uses' => 'Http\Controllers\Admin\DashboardController@index'
|
||||
]);
|
||||
|
||||
Route::group([
|
||||
'namespace' => 'Admin',
|
||||
'middleware' => ['role:admin'],
|
||||
'namespace' => 'Http\Controllers\Admin',
|
||||
//'middleware' => ['role:admin'],
|
||||
'prefix' => 'admin',
|
||||
], function () {
|
||||
Route::resource('airports', 'AirportController');
|
||||
Route::resource('airlines', 'AirlinesController');
|
||||
Route::resource('aircraft', 'AircraftController');
|
||||
Route::resource('aircraftclasses', 'AircraftClassController');
|
||||
Route::resource('fares', 'FareController');
|
||||
});
|
||||
});*/
|
||||
|
@ -19,7 +19,26 @@ Route::get('/home', 'HomeController@index');
|
||||
|
||||
Route::group([
|
||||
'namespace' => 'Frontend',
|
||||
'middleware' => ['role:admin', 'role:user'],
|
||||
'middleware' => ['role:admin|user'],
|
||||
], function () {
|
||||
Route::resource('dashboard', 'DashboardController');
|
||||
});
|
||||
|
||||
/**
|
||||
* Admin Routes
|
||||
*/
|
||||
|
||||
Route::group([
|
||||
'namespace' => 'Admin',
|
||||
'middleware' => ['role:admin'],
|
||||
'prefix' => 'admin',
|
||||
], function () {
|
||||
Route::get('', ['uses' => 'DashboardController@index']);
|
||||
Route::get('/', ['uses' => 'DashboardController@index']);
|
||||
|
||||
Route::resource('airports', 'AirportController');
|
||||
Route::resource('airlines', 'AirlinesController');
|
||||
Route::resource('aircraft', 'AircraftController');
|
||||
Route::resource('aircraftclasses', 'AircraftClassController');
|
||||
Route::resource('fares', 'FareController');
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user