Airlines model and controller
This commit is contained in:
14
Makefile
14
Makefile
@@ -12,9 +12,19 @@ build:
|
|||||||
composer install
|
composer install
|
||||||
|
|
||||||
install:
|
install:
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
db:
|
||||||
|
sqlite3 tmp/database.sqlite ""
|
||||||
|
php artisan migrate
|
||||||
|
|
||||||
|
reset-db:
|
||||||
|
rm tmp/database.sqlite
|
||||||
|
make db
|
||||||
|
|
||||||
schema:
|
schema:
|
||||||
php artisan infyom:scaffold Airlines --fieldsFile=database/schema/airlines.json
|
#php artisan infyom:scaffold Airlines --fieldsFile=database/schema/airlines.json
|
||||||
|
echo ""
|
||||||
|
|
||||||
docker:
|
docker:
|
||||||
@mkdir -p $(CURR_PATH)/tmp/mysql
|
@mkdir -p $(CURR_PATH)/tmp/mysql
|
||||||
@@ -32,3 +42,5 @@ docker-clean:
|
|||||||
-docker rm -rf phpvms
|
-docker rm -rf phpvms
|
||||||
-rm core/local.config.php
|
-rm core/local.config.php
|
||||||
-rm -rf tmp/mysql
|
-rm -rf tmp/mysql
|
||||||
|
|
||||||
|
.PHONY: all build install db reset-db schema docker docker-clean
|
||||||
|
|||||||
23
app/Http/Controllers/Admin/AdminBaseController.php
Normal file
23
app/Http/Controllers/Admin/AdminBaseController.php
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Admin;
|
||||||
|
|
||||||
|
use InfyOm\Generator\Utils\ResponseUtil;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Response;
|
||||||
|
|
||||||
|
|
||||||
|
class AdminBaseController extends Controller
|
||||||
|
{
|
||||||
|
protected $layout = 'layouts.admin';
|
||||||
|
|
||||||
|
public function sendResponse($result, $message)
|
||||||
|
{
|
||||||
|
return Response::json(ResponseUtil::makeResponse($message, $result));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function sendError($error, $code = 404)
|
||||||
|
{
|
||||||
|
return Response::json(ResponseUtil::makeError($error), $code);
|
||||||
|
}
|
||||||
|
}
|
||||||
145
app/Http/Controllers/Admin/AirlinesController.php
Normal file
145
app/Http/Controllers/Admin/AirlinesController.php
Normal file
@@ -0,0 +1,145 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Admin;
|
||||||
|
|
||||||
|
use App\Http\Requests\CreateAirlinesRequest;
|
||||||
|
use App\Http\Requests\UpdateAirlinesRequest;
|
||||||
|
use App\Repositories\AirlinesRepository;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Flash;
|
||||||
|
use Prettus\Repository\Criteria\RequestCriteria;
|
||||||
|
use Response;
|
||||||
|
|
||||||
|
class AirlinesController extends AdminBaseController
|
||||||
|
{
|
||||||
|
/** @var AirlinesRepository */
|
||||||
|
private $airlinesRepository;
|
||||||
|
|
||||||
|
public function __construct(AirlinesRepository $airlinesRepo)
|
||||||
|
{
|
||||||
|
$this->airlinesRepository = $airlinesRepo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display a listing of the Airlines.
|
||||||
|
*/
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
$this->airlinesRepository->pushCriteria(new RequestCriteria($request));
|
||||||
|
$airlines = $this->airlinesRepository->all();
|
||||||
|
|
||||||
|
return view('admin.airlines.index')
|
||||||
|
->with('airlines', $airlines);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new Airlines.
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
return view('admin.airlines.create');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created Airlines in storage.
|
||||||
|
*/
|
||||||
|
public function store(CreateAirlinesRequest $request)
|
||||||
|
{
|
||||||
|
$input = $request->all();
|
||||||
|
|
||||||
|
$airlines = $this->airlinesRepository->create($input);
|
||||||
|
|
||||||
|
Flash::success('Airlines saved successfully.');
|
||||||
|
|
||||||
|
return redirect(route('airlines.index'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display the specified Airlines.
|
||||||
|
*
|
||||||
|
* @param int $id
|
||||||
|
*
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
$airlines = $this->airlinesRepository->findWithoutFail($id);
|
||||||
|
|
||||||
|
if (empty($airlines)) {
|
||||||
|
Flash::error('Airlines not found');
|
||||||
|
|
||||||
|
return redirect(route('airlines.index'));
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('admin.airlines.show')->with('airlines', $airlines);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified Airlines.
|
||||||
|
*
|
||||||
|
* @param int $id
|
||||||
|
*
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
$airlines = $this->airlinesRepository->findWithoutFail($id);
|
||||||
|
|
||||||
|
if (empty($airlines)) {
|
||||||
|
Flash::error('Airlines not found');
|
||||||
|
|
||||||
|
return redirect(route('airlines.index'));
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('admin.airlines.edit')->with('airlines', $airlines);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified Airlines in storage.
|
||||||
|
*
|
||||||
|
* @param int $id
|
||||||
|
* @param UpdateAirlinesRequest $request
|
||||||
|
*
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function update($id, UpdateAirlinesRequest $request)
|
||||||
|
{
|
||||||
|
$airlines = $this->airlinesRepository->findWithoutFail($id);
|
||||||
|
|
||||||
|
if (empty($airlines)) {
|
||||||
|
Flash::error('Airlines not found');
|
||||||
|
|
||||||
|
return redirect(route('airlines.index'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$airlines = $this->airlinesRepository->update($request->all(), $id);
|
||||||
|
|
||||||
|
Flash::success('Airlines updated successfully.');
|
||||||
|
|
||||||
|
return redirect(route('airlines.index'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified Airlines from storage.
|
||||||
|
*
|
||||||
|
* @param int $id
|
||||||
|
*
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
$airlines = $this->airlinesRepository->findWithoutFail($id);
|
||||||
|
|
||||||
|
if (empty($airlines)) {
|
||||||
|
Flash::error('Airlines not found');
|
||||||
|
|
||||||
|
return redirect(route('airlines.index'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->airlinesRepository->delete($id);
|
||||||
|
|
||||||
|
Flash::success('Airlines deleted successfully.');
|
||||||
|
|
||||||
|
return redirect(route('airlines.index'));
|
||||||
|
}
|
||||||
|
}
|
||||||
30
app/Http/Requests/CreateAirlinesRequest.php
Normal file
30
app/Http/Requests/CreateAirlinesRequest.php
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Requests;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
use App\Models\Airlines;
|
||||||
|
|
||||||
|
class CreateAirlinesRequest extends FormRequest
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 Airlines::$rules;
|
||||||
|
}
|
||||||
|
}
|
||||||
30
app/Http/Requests/UpdateAirlinesRequest.php
Normal file
30
app/Http/Requests/UpdateAirlinesRequest.php
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Requests;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
use App\Models\Airlines;
|
||||||
|
|
||||||
|
class UpdateAirlinesRequest extends FormRequest
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 Airlines::$rules;
|
||||||
|
}
|
||||||
|
}
|
||||||
48
app/Models/Airlines.php
Normal file
48
app/Models/Airlines.php
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Eloquent as Model;
|
||||||
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class Airlines
|
||||||
|
* @package App\Models
|
||||||
|
*/
|
||||||
|
class Airlines extends Model
|
||||||
|
{
|
||||||
|
use SoftDeletes;
|
||||||
|
|
||||||
|
public $table = 'airlines';
|
||||||
|
|
||||||
|
protected $dates = ['deleted_at'];
|
||||||
|
|
||||||
|
public $fillable = [
|
||||||
|
'code',
|
||||||
|
'name',
|
||||||
|
'enabled'
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that should be casted to native types.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $casts = [
|
||||||
|
'code' => 'string',
|
||||||
|
'name' => 'string',
|
||||||
|
'enabled' => 'boolean'
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validation rules
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public static $rules = [
|
||||||
|
'code' => 'required|max:3',
|
||||||
|
'name' => 'required',
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
25
app/Repositories/AirlinesRepository.php
Normal file
25
app/Repositories/AirlinesRepository.php
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Repositories;
|
||||||
|
|
||||||
|
use App\Models\Airlines;
|
||||||
|
use InfyOm\Generator\Common\BaseRepository;
|
||||||
|
|
||||||
|
class AirlinesRepository extends BaseRepository
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $fieldSearchable = [
|
||||||
|
'code',
|
||||||
|
'name'
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configure the Model
|
||||||
|
**/
|
||||||
|
public function model()
|
||||||
|
{
|
||||||
|
return Airlines::class;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -48,11 +48,11 @@ return [
|
|||||||
|
|
||||||
'sqlite' => [
|
'sqlite' => [
|
||||||
'driver' => 'sqlite',
|
'driver' => 'sqlite',
|
||||||
'database' => env('DB_DATABASE', database_path('tmp/database.sqlite')),
|
'database' => env('DB_DATABASE', base_path('tmp/database.sqlite')),
|
||||||
'prefix' => '',
|
'prefix' => '',
|
||||||
],
|
],
|
||||||
|
|
||||||
'mysql' => [
|
/*'mysql' => [
|
||||||
'driver' => 'mysql',
|
'driver' => 'mysql',
|
||||||
'host' => env('DB_HOST', 'localhost'),
|
'host' => env('DB_HOST', 'localhost'),
|
||||||
'port' => env('DB_PORT', '3306'),
|
'port' => env('DB_PORT', '3306'),
|
||||||
@@ -64,7 +64,7 @@ return [
|
|||||||
'prefix' => '',
|
'prefix' => '',
|
||||||
'strict' => true,
|
'strict' => true,
|
||||||
'engine' => null,
|
'engine' => null,
|
||||||
],
|
],*/
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ return [
|
|||||||
|
|
||||||
|
|
||||||
'prefixes' => [
|
'prefixes' => [
|
||||||
'route' => '', // using admin will create route('admin.?.index') type routes
|
'route' => 'admin', // using admin will create route('admin.?.index') type routes
|
||||||
'path' => '',
|
'path' => '',
|
||||||
'view' => 'admin',
|
'view' => 'admin',
|
||||||
'public' => 'admin',
|
'public' => 'admin',
|
||||||
|
|||||||
@@ -15,21 +15,20 @@ class CreateUsersTable extends Migration
|
|||||||
{
|
{
|
||||||
Schema::create('users', function (Blueprint $table) {
|
Schema::create('users', function (Blueprint $table) {
|
||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
$table->string('first_name');
|
$table->string('name');
|
||||||
$table->string('last_name');
|
$table->string('first_name')->nullable();
|
||||||
|
$table->string('last_name')->nullable();
|
||||||
$table->string('email')->unique();
|
$table->string('email')->unique();
|
||||||
$table->string('password');
|
$table->string('password');
|
||||||
$table->string('code');
|
$table->string('code')->nullable();
|
||||||
$table->string('location');
|
$table->string('location')->nullable();
|
||||||
$table->string('hub');
|
$table->string('hub')->nullable();
|
||||||
$table->unsignedBigInteger('flights');
|
$table->unsignedBigInteger('flights')->nullable();
|
||||||
$table->float('hours');
|
$table->float('hours')->nullable();
|
||||||
$table->float('pay');
|
$table->float('pay')->nullable();
|
||||||
$table->boolean('confirmed');
|
$table->boolean('confirmed')->nullable();
|
||||||
$table->boolean('retired');
|
$table->boolean('retired')->nullable();
|
||||||
$table->dateTime('last_pirep');
|
$table->dateTime('last_pirep')->nullable();
|
||||||
$table->dateTime('created_at');
|
|
||||||
$table->dateTime('updated_at');
|
|
||||||
$table->rememberToken();
|
$table->rememberToken();
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
|
||||||
|
class CreateAirlinesTable extends Migration
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('airlines', function (Blueprint $table) {
|
||||||
|
$table->increments('id');
|
||||||
|
$table->string('code');
|
||||||
|
$table->string('name');
|
||||||
|
$table->boolean('enabled');
|
||||||
|
$table->timestamps();
|
||||||
|
$table->softDeletes();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::drop('airlines');
|
||||||
|
}
|
||||||
|
}
|
||||||
24
resources/views/admin/airlines/create.blade.php
Normal file
24
resources/views/admin/airlines/create.blade.php
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
@extends('layouts.admin.app')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<section class="content-header">
|
||||||
|
<h1>
|
||||||
|
Airlines
|
||||||
|
</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' => 'airlines.store']) !!}
|
||||||
|
|
||||||
|
@include('admin.airlines.fields')
|
||||||
|
|
||||||
|
{!! Form::close() !!}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
23
resources/views/admin/airlines/edit.blade.php
Normal file
23
resources/views/admin/airlines/edit.blade.php
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
@extends('layouts.admin.app')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<section class="content-header">
|
||||||
|
<h1>
|
||||||
|
Airlines
|
||||||
|
</h1>
|
||||||
|
</section>
|
||||||
|
<div class="content">
|
||||||
|
@include('adminlte-templates::common.errors')
|
||||||
|
<div class="box box-primary">
|
||||||
|
<div class="box-body">
|
||||||
|
<div class="row">
|
||||||
|
{!! Form::model($airlines, ['route' => ['airlines.update', $airlines->id], 'method' => 'patch']) !!}
|
||||||
|
|
||||||
|
@include('admin.airlines.fields')
|
||||||
|
|
||||||
|
{!! Form::close() !!}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
26
resources/views/admin/airlines/fields.blade.php
Normal file
26
resources/views/admin/airlines/fields.blade.php
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<!-- Code Field -->
|
||||||
|
<div class="form-group col-sm-6">
|
||||||
|
{!! Form::label('code', 'Code:') !!}
|
||||||
|
{!! Form::text('code', null, ['class' => 'form-control']) !!}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Name Field -->
|
||||||
|
<div class="form-group col-sm-6">
|
||||||
|
{!! Form::label('name', 'Name:') !!}
|
||||||
|
{!! Form::text('name', null, ['class' => 'form-control']) !!}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Enabled Field -->
|
||||||
|
<div class="form-group col-sm-6">
|
||||||
|
{!! Form::label('enabled', 'Enabled:') !!}
|
||||||
|
<label class="checkbox-inline">
|
||||||
|
{!! Form::hidden('enabled', false) !!}
|
||||||
|
{!! Form::checkbox('enabled', 'True', null) !!} 1
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Submit Field -->
|
||||||
|
<div class="form-group col-sm-12">
|
||||||
|
{!! Form::submit('Save', ['class' => 'btn btn-primary']) !!}
|
||||||
|
<a href="{!! route('airlines.index') !!}" class="btn btn-default">Cancel</a>
|
||||||
|
</div>
|
||||||
23
resources/views/admin/airlines/index.blade.php
Normal file
23
resources/views/admin/airlines/index.blade.php
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
@extends('layouts.admin.app')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<section class="content-header">
|
||||||
|
<h1 class="pull-left">Airlines</h1>
|
||||||
|
<h1 class="pull-right">
|
||||||
|
<a class="btn btn-primary pull-right" style="margin-top: -10px;margin-bottom: 5px" href="{!! route('airlines.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.airlines.table')
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
|
|
||||||
19
resources/views/admin/airlines/show.blade.php
Normal file
19
resources/views/admin/airlines/show.blade.php
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
@extends('layouts.admin.app')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<section class="content-header">
|
||||||
|
<h1>
|
||||||
|
Airlines
|
||||||
|
</h1>
|
||||||
|
</section>
|
||||||
|
<div class="content">
|
||||||
|
<div class="box box-primary">
|
||||||
|
<div class="box-body">
|
||||||
|
<div class="row" style="padding-left: 20px">
|
||||||
|
@include('admin.airlines.show_fields')
|
||||||
|
<a href="{!! route('airlines.index') !!}" class="btn btn-default">Back</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
36
resources/views/admin/airlines/show_fields.blade.php
Normal file
36
resources/views/admin/airlines/show_fields.blade.php
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
<!-- Id Field -->
|
||||||
|
<div class="form-group">
|
||||||
|
{!! Form::label('id', 'Id:') !!}
|
||||||
|
<p>{!! $airlines->id !!}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Code Field -->
|
||||||
|
<div class="form-group">
|
||||||
|
{!! Form::label('code', 'Code:') !!}
|
||||||
|
<p>{!! $airlines->code !!}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Name Field -->
|
||||||
|
<div class="form-group">
|
||||||
|
{!! Form::label('name', 'Name:') !!}
|
||||||
|
<p>{!! $airlines->name !!}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Enabled Field -->
|
||||||
|
<div class="form-group">
|
||||||
|
{!! Form::label('enabled', 'Enabled:') !!}
|
||||||
|
<p>{!! $airlines->enabled !!}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Created At Field -->
|
||||||
|
<div class="form-group">
|
||||||
|
{!! Form::label('created_at', 'Created At:') !!}
|
||||||
|
<p>{!! $airlines->created_at !!}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Updated At Field -->
|
||||||
|
<div class="form-group">
|
||||||
|
{!! Form::label('updated_at', 'Updated At:') !!}
|
||||||
|
<p>{!! $airlines->updated_at !!}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
26
resources/views/admin/airlines/table.blade.php
Normal file
26
resources/views/admin/airlines/table.blade.php
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<table class="table table-responsive" id="airlines-table">
|
||||||
|
<thead>
|
||||||
|
<th>Code</th>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Enabled</th>
|
||||||
|
<th colspan="3">Action</th>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach($airlines as $airlines)
|
||||||
|
<tr>
|
||||||
|
<td>{!! $airlines->code !!}</td>
|
||||||
|
<td>{!! $airlines->name !!}</td>
|
||||||
|
<td>{!! $airlines->enabled !!}</td>
|
||||||
|
<td>
|
||||||
|
{!! Form::open(['route' => ['airlines.destroy', $airlines->id], 'method' => 'delete']) !!}
|
||||||
|
<div class='btn-group'>
|
||||||
|
<a href="{!! route('airlines.show', [$airlines->id]) !!}" class='btn btn-default btn-xs'><i class="glyphicon glyphicon-eye-open"></i></a>
|
||||||
|
<a href="{!! route('airlines.edit', [$airlines->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>
|
||||||
153
resources/views/layouts/admin/app.blade.php
Normal file
153
resources/views/layouts/admin/app.blade.php
Normal file
@@ -0,0 +1,153 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>phpVMS Admin</title>
|
||||||
|
<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
|
||||||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css">
|
||||||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.2/css/select2.min.css">
|
||||||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/admin-lte/2.3.3/css/AdminLTE.min.css">
|
||||||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/admin-lte/2.3.3/css/skins/_all-skins.min.css">
|
||||||
|
|
||||||
|
<!-- Ionicons -->
|
||||||
|
<link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
|
||||||
|
|
||||||
|
@yield('css')
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body class="skin-blue sidebar-mini">
|
||||||
|
@if (!Auth::guest())
|
||||||
|
<div class="wrapper">
|
||||||
|
<!-- Main Header -->
|
||||||
|
<header class="main-header">
|
||||||
|
|
||||||
|
<!-- Logo -->
|
||||||
|
<a href="#" class="logo">
|
||||||
|
<b>phpVMS<sup>nxt</sup></b>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<!-- Header Navbar -->
|
||||||
|
<nav class="navbar navbar-static-top" role="navigation">
|
||||||
|
<!-- Sidebar toggle button-->
|
||||||
|
<a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
|
||||||
|
<span class="sr-only">Toggle navigation</span>
|
||||||
|
</a>
|
||||||
|
<!-- Navbar Right Menu -->
|
||||||
|
<div class="navbar-custom-menu">
|
||||||
|
<ul class="nav navbar-nav">
|
||||||
|
<!-- User Account Menu -->
|
||||||
|
<li class="dropdown user user-menu">
|
||||||
|
<!-- Menu Toggle Button -->
|
||||||
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
|
||||||
|
<!-- The user image in the navbar-->
|
||||||
|
<img src="http://infyom.com/images/logo/blue_logo_150x150.jpg"
|
||||||
|
class="user-image" alt="User Image"/>
|
||||||
|
<!-- hidden-xs hides the username on small devices so only the image appears. -->
|
||||||
|
<span class="hidden-xs">{!! Auth::user()->name !!}</span>
|
||||||
|
</a>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
<!-- The user image in the menu -->
|
||||||
|
<li class="user-header">
|
||||||
|
<img src="http://infyom.com/images/logo/blue_logo_150x150.jpg"
|
||||||
|
class="img-circle" alt="User Image"/>
|
||||||
|
<p>
|
||||||
|
{!! Auth::user()->name !!}
|
||||||
|
<small>Member since {!! Auth::user()->created_at->format('M. Y') !!}</small>
|
||||||
|
</p>
|
||||||
|
</li>
|
||||||
|
<!-- Menu Footer-->
|
||||||
|
<li class="user-footer">
|
||||||
|
<div class="pull-left">
|
||||||
|
<a href="#" class="btn btn-default btn-flat">Profile</a>
|
||||||
|
</div>
|
||||||
|
<div class="pull-right">
|
||||||
|
<a href="{!! url('/logout') !!}" class="btn btn-default btn-flat"
|
||||||
|
onclick="event.preventDefault(); document.getElementById('logout-form').submit();">
|
||||||
|
Sign out
|
||||||
|
</a>
|
||||||
|
<form id="logout-form" action="{{ url('/logout') }}" method="POST" style="display: none;">
|
||||||
|
{{ csrf_field() }}
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<!-- Left side column. contains the logo and sidebar -->
|
||||||
|
@include('layouts.admin.sidebar')
|
||||||
|
<!-- Content Wrapper. Contains page content -->
|
||||||
|
<div class="content-wrapper">
|
||||||
|
@yield('content')
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Main Footer -->
|
||||||
|
<footer class="main-footer" style="max-height: 100px;text-align: center">
|
||||||
|
<strong>Copyright © 2016 <a href="#">Company</a>.</strong> All rights reserved.
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
@else
|
||||||
|
<nav class="navbar navbar-default navbar-static-top">
|
||||||
|
<div class="container">
|
||||||
|
<div class="navbar-header">
|
||||||
|
|
||||||
|
<!-- Collapsed Hamburger -->
|
||||||
|
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
|
||||||
|
data-target="#app-navbar-collapse">
|
||||||
|
<span class="sr-only">Toggle Navigation</span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<!-- Branding Image -->
|
||||||
|
<a class="navbar-brand" href="{!! url('/') !!}">
|
||||||
|
InfyOm Generator
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="collapse navbar-collapse" id="app-navbar-collapse">
|
||||||
|
<!-- Left Side Of Navbar -->
|
||||||
|
<ul class="nav navbar-nav">
|
||||||
|
<li><a href="{!! url('/home') !!}">Home</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<!-- Right Side Of Navbar -->
|
||||||
|
<ul class="nav navbar-nav navbar-right">
|
||||||
|
<!-- Authentication Links -->
|
||||||
|
<li><a href="{!! url('/login') !!}">Login</a></li>
|
||||||
|
<li><a href="{!! url('/register') !!}">Register</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<div id="page-content-wrapper">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-12">
|
||||||
|
@yield('content')
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<!-- jQuery 2.1.4 -->
|
||||||
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
|
||||||
|
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.2/js/select2.min.js"></script>
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/iCheck/1.0.2/icheck.min.js"></script>
|
||||||
|
|
||||||
|
<!-- AdminLTE App -->
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/admin-lte/2.3.3/js/app.min.js"></script>
|
||||||
|
|
||||||
|
@yield('scripts')
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
1
resources/views/layouts/admin/menu.blade.php
Normal file
1
resources/views/layouts/admin/menu.blade.php
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<li><a href="{!! url('/admin/airlines') !!}">airlines</a></li>
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="pull-left info">
|
<div class="pull-left info">
|
||||||
@if (Auth::guest())
|
@if (Auth::guest())
|
||||||
<p>InfyOm</p>
|
<p>phpVMS Admin</p>
|
||||||
@else
|
@else
|
||||||
<p>{{ Auth::user()->name}}</p>
|
<p>{{ Auth::user()->name}}</p>
|
||||||
@endif
|
@endif
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
<!-- Sidebar Menu -->
|
<!-- Sidebar Menu -->
|
||||||
|
|
||||||
<ul class="sidebar-menu">
|
<ul class="sidebar-menu">
|
||||||
@include('layouts.menu')
|
@include('layouts.admin.menu')
|
||||||
</ul>
|
</ul>
|
||||||
<!-- /.sidebar-menu -->
|
<!-- /.sidebar-menu -->
|
||||||
</section>
|
</section>
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>InfyOm Generator</title>
|
<title>phpvms</title>
|
||||||
<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
|
<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
|
||||||
|
|
||||||
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
|
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
|
||||||
@@ -18,126 +18,21 @@
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="skin-blue sidebar-mini">
|
<body class="skin-blue sidebar-mini">
|
||||||
@if (!Auth::guest())
|
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
<!-- Main Header -->
|
<div id="page-content-wrapper">
|
||||||
<header class="main-header">
|
<div class="container-fluid">
|
||||||
|
<div class="row">
|
||||||
<!-- Logo -->
|
<div class="col-lg-12">
|
||||||
<a href="#" class="logo">
|
@yield('content')
|
||||||
<b>InfyOm</b>
|
</div>
|
||||||
</a>
|
|
||||||
|
|
||||||
<!-- Header Navbar -->
|
|
||||||
<nav class="navbar navbar-static-top" role="navigation">
|
|
||||||
<!-- Sidebar toggle button-->
|
|
||||||
<a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
|
|
||||||
<span class="sr-only">Toggle navigation</span>
|
|
||||||
</a>
|
|
||||||
<!-- Navbar Right Menu -->
|
|
||||||
<div class="navbar-custom-menu">
|
|
||||||
<ul class="nav navbar-nav">
|
|
||||||
<!-- User Account Menu -->
|
|
||||||
<li class="dropdown user user-menu">
|
|
||||||
<!-- Menu Toggle Button -->
|
|
||||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
|
|
||||||
<!-- The user image in the navbar-->
|
|
||||||
<img src="http://infyom.com/images/logo/blue_logo_150x150.jpg"
|
|
||||||
class="user-image" alt="User Image"/>
|
|
||||||
<!-- hidden-xs hides the username on small devices so only the image appears. -->
|
|
||||||
<span class="hidden-xs">{!! Auth::user()->name !!}</span>
|
|
||||||
</a>
|
|
||||||
<ul class="dropdown-menu">
|
|
||||||
<!-- The user image in the menu -->
|
|
||||||
<li class="user-header">
|
|
||||||
<img src="http://infyom.com/images/logo/blue_logo_150x150.jpg"
|
|
||||||
class="img-circle" alt="User Image"/>
|
|
||||||
<p>
|
|
||||||
{!! Auth::user()->name !!}
|
|
||||||
<small>Member since {!! Auth::user()->created_at->format('M. Y') !!}</small>
|
|
||||||
</p>
|
|
||||||
</li>
|
|
||||||
<!-- Menu Footer-->
|
|
||||||
<li class="user-footer">
|
|
||||||
<div class="pull-left">
|
|
||||||
<a href="#" class="btn btn-default btn-flat">Profile</a>
|
|
||||||
</div>
|
|
||||||
<div class="pull-right">
|
|
||||||
<a href="{!! url('/logout') !!}" class="btn btn-default btn-flat"
|
|
||||||
onclick="event.preventDefault(); document.getElementById('logout-form').submit();">
|
|
||||||
Sign out
|
|
||||||
</a>
|
|
||||||
<form id="logout-form" action="{{ url('/logout') }}" method="POST" style="display: none;">
|
|
||||||
{{ csrf_field() }}
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<!-- Left side column. contains the logo and sidebar -->
|
|
||||||
@include('layouts.sidebar')
|
|
||||||
<!-- Content Wrapper. Contains page content -->
|
|
||||||
<div class="content-wrapper">
|
|
||||||
@yield('content')
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Main Footer -->
|
|
||||||
<footer class="main-footer" style="max-height: 100px;text-align: center">
|
|
||||||
<strong>Copyright © 2016 <a href="#">Company</a>.</strong> All rights reserved.
|
|
||||||
</footer>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
@else
|
|
||||||
<nav class="navbar navbar-default navbar-static-top">
|
|
||||||
<div class="container">
|
|
||||||
<div class="navbar-header">
|
|
||||||
|
|
||||||
<!-- Collapsed Hamburger -->
|
|
||||||
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
|
|
||||||
data-target="#app-navbar-collapse">
|
|
||||||
<span class="sr-only">Toggle Navigation</span>
|
|
||||||
<span class="icon-bar"></span>
|
|
||||||
<span class="icon-bar"></span>
|
|
||||||
<span class="icon-bar"></span>
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<!-- Branding Image -->
|
|
||||||
<a class="navbar-brand" href="{!! url('/') !!}">
|
|
||||||
InfyOm Generator
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="collapse navbar-collapse" id="app-navbar-collapse">
|
|
||||||
<!-- Left Side Of Navbar -->
|
|
||||||
<ul class="nav navbar-nav">
|
|
||||||
<li><a href="{!! url('/home') !!}">Home</a></li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<!-- Right Side Of Navbar -->
|
|
||||||
<ul class="nav navbar-nav navbar-right">
|
|
||||||
<!-- Authentication Links -->
|
|
||||||
<li><a href="{!! url('/login') !!}">Login</a></li>
|
|
||||||
<li><a href="{!! url('/register') !!}">Register</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<div id="page-content-wrapper">
|
|
||||||
<div class="container-fluid">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-lg-12">
|
|
||||||
@yield('content')
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
<!-- Main Footer -->
|
||||||
|
<footer class="main-footer" style="max-height: 100px;text-align: center">
|
||||||
|
<strong>Copyright © 2016 <a href="#">Company</a>.</strong> All rights reserved.
|
||||||
|
</footer>
|
||||||
|
|
||||||
<!-- jQuery 2.1.4 -->
|
<!-- jQuery 2.1.4 -->
|
||||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
|
||||||
|
|||||||
@@ -16,5 +16,18 @@ Route::get('/', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
Auth::routes();
|
|
||||||
Route::get('/home', 'HomeController@index');
|
Route::get('/home', 'HomeController@index');
|
||||||
|
|
||||||
|
|
||||||
|
//Auth::routes();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Admin routes
|
||||||
|
*/
|
||||||
|
Route::group([
|
||||||
|
'namespace' => 'Admin',
|
||||||
|
'middleware' => 'auth',
|
||||||
|
'prefix' => 'admin',
|
||||||
|
], function () {
|
||||||
|
Route::resource('airlines', 'AirlinesController');
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user