user info

This commit is contained in:
Nabeel Shahzad 2017-06-09 14:47:02 -05:00
parent 292727cf74
commit 8831f875ef
20 changed files with 560 additions and 43 deletions

2
.gitignore vendored
View File

@ -1,4 +1,4 @@
vendor/
/vendor
node_modules/
npm-debug.log

View File

@ -6,21 +6,11 @@ use Illuminate\Http\Request;
class HomeController extends Controller
{
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
//$this->middleware('auth');
}
/**
* Show the application dashboard.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
return view('home');

View File

@ -1,21 +0,0 @@
<?php
namespace App\Http\Controllers\User;
use InfyOm\Generator\Utils\ResponseUtil;
use App\Http\Controllers\Controller;
use Response;
class UserBaseController extends Controller
{
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);
}
}

View File

@ -0,0 +1,111 @@
(function ($, DataTable) {
"use strict";
var _buildUrl = function(dt, action) {
var url = dt.ajax.url() || '';
var params = dt.ajax.params();
params.action = action;
return url + '?' + $.param(params);
};
DataTable.ext.buttons.excel = {
className: 'buttons-excel',
text: function (dt) {
return '<i class="fa fa-file-excel-o"></i> ' + dt.i18n('buttons.excel', 'Excel');
},
action: function (e, dt, button, config) {
var url = _buildUrl(dt, 'excel');
window.location = url;
}
};
DataTable.ext.buttons.export = {
extend: 'collection',
className: 'buttons-export',
text: function (dt) {
return '<i class="fa fa-download"></i> ' + dt.i18n('buttons.export', 'Export') + '&nbsp;<span class="caret"/>';
},
buttons: ['csv', 'excel', 'pdf']
};
DataTable.ext.buttons.csv = {
className: 'buttons-csv',
text: function (dt) {
return '<i class="fa fa-file-excel-o"></i> ' + dt.i18n('buttons.csv', 'CSV');
},
action: function (e, dt, button, config) {
var url = _buildUrl(dt, 'csv');
window.location = url;
}
};
DataTable.ext.buttons.pdf = {
className: 'buttons-pdf',
text: function (dt) {
return '<i class="fa fa-file-pdf-o"></i> ' + dt.i18n('buttons.pdf', 'PDF');
},
action: function (e, dt, button, config) {
var url = _buildUrl(dt, 'pdf');
window.location = url;
}
};
DataTable.ext.buttons.print = {
className: 'buttons-print',
text: function (dt) {
return '<i class="fa fa-print"></i> ' + dt.i18n('buttons.print', 'Print');
},
action: function (e, dt, button, config) {
var url = _buildUrl(dt, 'print');
window.location = url;
}
};
DataTable.ext.buttons.reset = {
className: 'buttons-reset',
text: function (dt) {
return '<i class="fa fa-undo"></i> ' + dt.i18n('buttons.reset', 'Reset');
},
action: function (e, dt, button, config) {
dt.search('').draw();
}
};
DataTable.ext.buttons.reload = {
className: 'buttons-reload',
text: function (dt) {
return '<i class="fa fa-refresh"></i> ' + dt.i18n('buttons.reload', 'Reload');
},
action: function (e, dt, button, config) {
dt.draw(false);
}
};
DataTable.ext.buttons.create = {
className: 'buttons-create',
text: function (dt) {
return '<i class="fa fa-plus"></i> ' + dt.i18n('buttons.create', 'Create');
},
action: function (e, dt, button, config) {
window.location = window.location.href.replace(/\/+$/, "") + '/create';
}
};
})(jQuery, jQuery.fn.dataTable);

View File

@ -1,4 +1,4 @@
@extends('layouts.app')
@extends('layouts.default.app')
@section('content')
<div class="container">

1
resources/views/vendor/.gitkeep vendored Executable file
View File

@ -0,0 +1 @@

View File

@ -0,0 +1,37 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Print Table</title>
<meta charset="UTF-8">
<meta name=description content="">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Bootstrap CSS -->
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
<style>
body {margin: 20px}
</style>
</head>
<body>
<table class="table table-bordered table-condensed table-striped">
@foreach($data as $row)
@if ($row == reset($data))
<tr>
@foreach($row as $key => $value)
<th>{!! $key !!}</th>
@endforeach
</tr>
@endif
<tr>
@foreach($row as $key => $value)
@if(is_string($value) || is_numeric($value))
<td>{!! $value !!}</td>
@else
<td></td>
@endif
@endforeach
</tr>
@endforeach
</table>
</body>
</html>

View File

@ -0,0 +1 @@
(function(window,$){window.LaravelDataTables=window.LaravelDataTables||{};window.LaravelDataTables["%1$s"]=$("#%1$s").DataTable(%2$s);})(window,jQuery);

View File

@ -0,0 +1,24 @@
@if (session()->has('flash_notification.message'))
@if (session()->has('flash_notification.overlay'))
@include('flash::modal', [
'modalClass' => 'flash-modal',
'title' => session('flash_notification.title'),
'body' => session('flash_notification.message')
])
@else
<div class="alert
alert-{{ session('flash_notification.level') }}
{{ session()->has('flash_notification.important') ? 'alert-important' : '' }}"
>
@if(session()->has('flash_notification.important'))
<button type="button"
class="close"
data-dismiss="alert"
aria-hidden="true"
>&times;</button>
@endif
{!! session('flash_notification.message') !!}
</div>
@endif
@endif

View File

@ -0,0 +1,19 @@
<div id="flash-overlay-modal" class="modal fade {{ $modalClass or '' }}">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title">{{ $title }}</h4>
</div>
<div class="modal-body">
<p>{!! $body !!}</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,22 @@
<?php
if (! empty($greeting)) {
echo $greeting, "\n\n";
} else {
echo $level == 'error' ? 'Whoops!' : 'Hello!', "\n\n";
}
if (! empty($introLines)) {
echo implode("\n", $introLines), "\n\n";
}
if (isset($actionText)) {
echo "{$actionText}: {$actionUrl}", "\n\n";
}
if (! empty($outroLines)) {
echo implode("\n", $outroLines), "\n\n";
}
echo 'Regards,', "\n";
echo config('app.name'), "\n";

View File

@ -0,0 +1,188 @@
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<style type="text/css" rel="stylesheet" media="all">
/* Media Queries */
@media only screen and (max-width: 500px) {
.button {
width: 100% !important;
}
}
</style>
</head>
<?php
$style = [
/* Layout ------------------------------ */
'body' => 'margin: 0; padding: 0; width: 100%; background-color: #F2F4F6;',
'email-wrapper' => 'width: 100%; margin: 0; padding: 0; background-color: #F2F4F6;',
/* Masthead ----------------------- */
'email-masthead' => 'padding: 25px 0; text-align: center;',
'email-masthead_name' => 'font-size: 16px; font-weight: bold; color: #2F3133; text-decoration: none; text-shadow: 0 1px 0 white;',
'email-body' => 'width: 100%; margin: 0; padding: 0; border-top: 1px solid #EDEFF2; border-bottom: 1px solid #EDEFF2; background-color: #FFF;',
'email-body_inner' => 'width: auto; max-width: 570px; margin: 0 auto; padding: 0;',
'email-body_cell' => 'padding: 35px;',
'email-footer' => 'width: auto; max-width: 570px; margin: 0 auto; padding: 0; text-align: center;',
'email-footer_cell' => 'color: #AEAEAE; padding: 35px; text-align: center;',
/* Body ------------------------------ */
'body_action' => 'width: 100%; margin: 30px auto; padding: 0; text-align: center;',
'body_sub' => 'margin-top: 25px; padding-top: 25px; border-top: 1px solid #EDEFF2;',
/* Type ------------------------------ */
'anchor' => 'color: #3869D4;',
'header-1' => 'margin-top: 0; color: #2F3133; font-size: 19px; font-weight: bold; text-align: left;',
'paragraph' => 'margin-top: 0; color: #74787E; font-size: 16px; line-height: 1.5em;',
'paragraph-sub' => 'margin-top: 0; color: #74787E; font-size: 12px; line-height: 1.5em;',
'paragraph-center' => 'text-align: center;',
/* Buttons ------------------------------ */
'button' => 'display: block; display: inline-block; width: 200px; min-height: 20px; padding: 10px;
background-color: #3869D4; border-radius: 3px; color: #ffffff; font-size: 15px; line-height: 25px;
text-align: center; text-decoration: none; -webkit-text-size-adjust: none;',
'button--green' => 'background-color: #22BC66;',
'button--red' => 'background-color: #dc4d2f;',
'button--blue' => 'background-color: #3869D4;',
];
?>
<?php $fontFamily = 'font-family: Arial, \'Helvetica Neue\', Helvetica, sans-serif;'; ?>
<body style="{{ $style['body'] }}">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td style="{{ $style['email-wrapper'] }}" align="center">
<table width="100%" cellpadding="0" cellspacing="0">
<!-- Logo -->
<tr>
<td style="{{ $style['email-masthead'] }}">
<a style="{{ $fontFamily }} {{ $style['email-masthead_name'] }}" href="{{ url('/') }}" target="_blank">
{{ config('app.name') }}
</a>
</td>
</tr>
<!-- Email Body -->
<tr>
<td style="{{ $style['email-body'] }}" width="100%">
<table style="{{ $style['email-body_inner'] }}" align="center" width="570" cellpadding="0" cellspacing="0">
<tr>
<td style="{{ $fontFamily }} {{ $style['email-body_cell'] }}">
<!-- Greeting -->
<h1 style="{{ $style['header-1'] }}">
@if ($level == 'error')
Whoops!
@else
Hello!
@endif
</h1>
<!-- Intro -->
@foreach ($introLines as $line)
<p style="{{ $style['paragraph'] }}">
{{ $line }}
</p>
@endforeach
<!-- Action Button -->
@if (isset($actionText))
<table style="{{ $style['body_action'] }}" align="center" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td align="center">
<?php
switch ($level) {
case 'success':
$actionColor = 'button--green';
break;
case 'error':
$actionColor = 'button--red';
break;
default:
$actionColor = 'button--blue';
}
?>
<a href="{{ $actionUrl }}"
style="{{ $fontFamily }} {{ $style['button'] }} {{ $style[$actionColor] }}"
class="button"
target="_blank">
{{ $actionText }}
</a>
</td>
</tr>
</table>
@endif
<!-- Outro -->
@foreach ($outroLines as $line)
<p style="{{ $style['paragraph'] }}">
{{ $line }}
</p>
@endforeach
<!-- Salutation -->
<p style="{{ $style['paragraph'] }}">
Regards,<br>{{ config('app.name') }}
</p>
<!-- Sub Copy -->
@if (isset($actionText))
<table style="{{ $style['body_sub'] }}">
<tr>
<td style="{{ $fontFamily }}">
<p style="{{ $style['paragraph-sub'] }}">
If youre having trouble clicking the "{{ $actionText }}" button,
copy and paste the URL below into your web browser:
</p>
<p style="{{ $style['paragraph-sub'] }}">
<a style="{{ $style['anchor'] }}" href="{{ $actionUrl }}" target="_blank">
{{ $actionUrl }}
</a>
</p>
</td>
</tr>
</table>
@endif
</td>
</tr>
</table>
</td>
</tr>
<!-- Footer -->
<tr>
<td>
<table style="{{ $style['email-footer'] }}" align="center" width="570" cellpadding="0" cellspacing="0">
<tr>
<td style="{{ $fontFamily }} {{ $style['email-footer_cell'] }}">
<p style="{{ $style['paragraph-sub'] }}">
&copy; {{ date('Y') }}
<a style="{{ $style['anchor'] }}" href="{{ url('/') }}" target="_blank">{{ config('app.name') }}</a>.
All rights reserved.
</p>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>

View File

@ -0,0 +1,34 @@
<ul class="pagination">
<!-- Previous Page Link -->
@if ($paginator->onFirstPage())
<li class="page-item disabled"><span class="page-link">&laquo;</span></li>
@else
<li class="page-item"><a class="page-link" href="{{ $paginator->previousPageUrl() }}" rel="prev">&laquo;</a></li>
@endif
<!-- Pagination Elements -->
@foreach ($elements as $element)
<!-- "Three Dots" Separator -->
@if (is_string($element))
<li class="page-item disabled"><span class="page-link">{{ $element }}</span></li>
@endif
<!-- Array Of Links -->
@if (is_array($element))
@foreach ($element as $page => $url)
@if ($page == $paginator->currentPage())
<li class="page-item active"><span class="page-link">{{ $page }}</span></li>
@else
<li class="page-item"><a class="page-link" href="{{ $url }}">{{ $page }}</a></li>
@endif
@endforeach
@endif
@endforeach
<!-- Next Page Link -->
@if ($paginator->hasMorePages())
<li class="page-item"><a class="page-link" href="{{ $paginator->nextPageUrl() }}" rel="next">&raquo;</a></li>
@else
<li class="page-item disabled"><span class="page-link">&raquo;</span></li>
@endif
</ul>

View File

@ -0,0 +1,34 @@
<ul class="pagination">
<!-- Previous Page Link -->
@if ($paginator->onFirstPage())
<li class="disabled"><span>&laquo;</span></li>
@else
<li><a href="{{ $paginator->previousPageUrl() }}" rel="prev">&laquo;</a></li>
@endif
<!-- Pagination Elements -->
@foreach ($elements as $element)
<!-- "Three Dots" Separator -->
@if (is_string($element))
<li class="disabled"><span>{{ $element }}</span></li>
@endif
<!-- Array Of Links -->
@if (is_array($element))
@foreach ($element as $page => $url)
@if ($page == $paginator->currentPage())
<li class="active"><span>{{ $page }}</span></li>
@else
<li><a href="{{ $url }}">{{ $page }}</a></li>
@endif
@endforeach
@endif
@endforeach
<!-- Next Page Link -->
@if ($paginator->hasMorePages())
<li><a href="{{ $paginator->nextPageUrl() }}" rel="next">&raquo;</a></li>
@else
<li class="disabled"><span>&raquo;</span></li>
@endif
</ul>

View File

@ -0,0 +1,15 @@
<ul class="pagination">
<!-- Previous Page Link -->
@if ($paginator->onFirstPage())
<li class="page-item disabled"><span class="page-link">&laquo;</span></li>
@else
<li class="page-item"><a class="page-link" href="{{ $paginator->previousPageUrl() }}" rel="prev">&laquo;</a></li>
@endif
<!-- Next Page Link -->
@if ($paginator->hasMorePages())
<li class="page-item"><a class="page-link" href="{{ $paginator->nextPageUrl() }}" rel="next">&raquo;</a></li>
@else
<li class="page-item disabled"><span class="page-link">&raquo;</span></li>
@endif
</ul>

View File

@ -0,0 +1,15 @@
<ul class="pagination">
<!-- Previous Page Link -->
@if ($paginator->onFirstPage())
<li class="disabled"><span>&laquo;</span></li>
@else
<li><a href="{{ $paginator->previousPageUrl() }}" rel="prev">&laquo;</a></li>
@endif
<!-- Next Page Link -->
@if ($paginator->hasMorePages())
<li><a href="{{ $paginator->nextPageUrl() }}" rel="next">&raquo;</a></li>
@else
<li class="disabled"><span>&raquo;</span></li>
@endif
</ul>

17
routes/admin.php Normal file
View File

@ -0,0 +1,17 @@
<?php
/**
* Admin routes
*/
Route::get('/admin', function () {
return redirect('/admin/airlines');
});
Route::group([
'namespace' => 'Admin',
//'middleware' => 'auth',
'prefix' => 'admin',
], function () {
Route::resource('airlines', 'AirlinesController');
Route::resource('aircraft', 'AircraftController');
});

View File

@ -17,21 +17,18 @@ Route::get('/', function () {
Route::get('/home', 'HomeController@index');
Route::get('/login', 'Auth\LoginController@index');
/**
* User routes that require auth
*/
Route::group([
/*Route::group([
'namespace' => 'User',
'middleware' => 'auth',
], function () {
});
/**
* Admin routes
*/
});*/
Route::get('/admin', function () {
return redirect('/admin/airlines');
@ -46,4 +43,3 @@ Route::group([
Route::resource('aircraft', 'AircraftController');
});

26
tests/AircraftTest.php Normal file
View File

@ -0,0 +1,26 @@
<?php
use Illuminate\Foundation\Testing\WithoutMiddleware;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;
class AircraftTest extends TestCase
{
protected $repo;
public function setUp() {
parent::setUp();
$this->repo = $this->createRepository('AircraftRepository');
}
/**
* A basic test example.
*
* @return void
*/
public function testRepository()
{
print_r($this->repo->model());
}
}

View File

@ -7,8 +7,13 @@ abstract class TestCase extends Illuminate\Foundation\Testing\TestCase
*
* @var string
*/
protected $app;
protected $baseUrl = 'http://localhost';
public function __construct($name = null, array $data = [], $dataName = '') {
parent::__construct($name, $data, $dataName);
}
/**
* Creates the application.
*
@ -17,9 +22,12 @@ abstract class TestCase extends Illuminate\Foundation\Testing\TestCase
public function createApplication()
{
$app = require __DIR__.'/../bootstrap/app.php';
$app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap();
return $app;
}
public function createRepository($repo_name) {
$app = $this->createApplication();
return $app->make('App\Repositories\\' + $repo_name);
}
}