From 8831f875ef445cb9e34b34f79b9418d5d04fc21f Mon Sep 17 00:00:00 2001 From: Nabeel Shahzad Date: Fri, 9 Jun 2017 14:47:02 -0500 Subject: [PATCH] user info --- .gitignore | 2 +- app/Http/Controllers/HomeController.php | 12 +- .../Controllers/User/UserBaseController.php | 21 -- .../vendor/datatables/buttons.server-side.js | 111 +++++++++++ resources/views/home.blade.php | 2 +- resources/views/vendor/.gitkeep | 1 + .../views/vendor/datatables/print.blade.php | 37 ++++ .../views/vendor/datatables/script.blade.php | 1 + .../views/vendor/flash/message.blade.php | 24 +++ resources/views/vendor/flash/modal.blade.php | 19 ++ .../notifications/email-plain.blade.php | 22 ++ .../vendor/notifications/email.blade.php | 188 ++++++++++++++++++ .../vendor/pagination/bootstrap-4.blade.php | 34 ++++ .../views/vendor/pagination/default.blade.php | 34 ++++ .../pagination/simple-bootstrap-4.blade.php | 15 ++ .../pagination/simple-default.blade.php | 15 ++ routes/admin.php | 17 ++ routes/web.php | 10 +- tests/AircraftTest.php | 26 +++ tests/TestCase.php | 12 +- 20 files changed, 560 insertions(+), 43 deletions(-) delete mode 100644 app/Http/Controllers/User/UserBaseController.php create mode 100644 public/vendor/datatables/buttons.server-side.js create mode 100755 resources/views/vendor/.gitkeep create mode 100644 resources/views/vendor/datatables/print.blade.php create mode 100644 resources/views/vendor/datatables/script.blade.php create mode 100644 resources/views/vendor/flash/message.blade.php create mode 100644 resources/views/vendor/flash/modal.blade.php create mode 100644 resources/views/vendor/notifications/email-plain.blade.php create mode 100644 resources/views/vendor/notifications/email.blade.php create mode 100644 resources/views/vendor/pagination/bootstrap-4.blade.php create mode 100644 resources/views/vendor/pagination/default.blade.php create mode 100644 resources/views/vendor/pagination/simple-bootstrap-4.blade.php create mode 100644 resources/views/vendor/pagination/simple-default.blade.php create mode 100644 routes/admin.php create mode 100644 tests/AircraftTest.php diff --git a/.gitignore b/.gitignore index 38943d8f..5e6c862e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -vendor/ +/vendor node_modules/ npm-debug.log diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index a3af7dd8..6f0380df 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -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'); diff --git a/app/Http/Controllers/User/UserBaseController.php b/app/Http/Controllers/User/UserBaseController.php deleted file mode 100644 index b31fd5fc..00000000 --- a/app/Http/Controllers/User/UserBaseController.php +++ /dev/null @@ -1,21 +0,0 @@ - ' + 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 ' ' + dt.i18n('buttons.export', 'Export') + ' '; + }, + + buttons: ['csv', 'excel', 'pdf'] + }; + + DataTable.ext.buttons.csv = { + className: 'buttons-csv', + + text: function (dt) { + return ' ' + 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 ' ' + 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 ' ' + 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 ' ' + 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 ' ' + 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 ' ' + dt.i18n('buttons.create', 'Create'); + }, + + action: function (e, dt, button, config) { + window.location = window.location.href.replace(/\/+$/, "") + '/create'; + } + }; +})(jQuery, jQuery.fn.dataTable); diff --git a/resources/views/home.blade.php b/resources/views/home.blade.php index 74cc5374..d0e173bd 100644 --- a/resources/views/home.blade.php +++ b/resources/views/home.blade.php @@ -1,4 +1,4 @@ -@extends('layouts.app') +@extends('layouts.default.app') @section('content')
diff --git a/resources/views/vendor/.gitkeep b/resources/views/vendor/.gitkeep new file mode 100755 index 00000000..8b137891 --- /dev/null +++ b/resources/views/vendor/.gitkeep @@ -0,0 +1 @@ + diff --git a/resources/views/vendor/datatables/print.blade.php b/resources/views/vendor/datatables/print.blade.php new file mode 100644 index 00000000..d9767b7d --- /dev/null +++ b/resources/views/vendor/datatables/print.blade.php @@ -0,0 +1,37 @@ + + + + Print Table + + + + + + + + + + + @foreach($data as $row) + @if ($row == reset($data)) + + @foreach($row as $key => $value) + + @endforeach + + @endif + + @foreach($row as $key => $value) + @if(is_string($value) || is_numeric($value)) + + @else + + @endif + @endforeach + + @endforeach +
{!! $key !!}
{!! $value !!}
+ + diff --git a/resources/views/vendor/datatables/script.blade.php b/resources/views/vendor/datatables/script.blade.php new file mode 100644 index 00000000..9abfa03e --- /dev/null +++ b/resources/views/vendor/datatables/script.blade.php @@ -0,0 +1 @@ +(function(window,$){window.LaravelDataTables=window.LaravelDataTables||{};window.LaravelDataTables["%1$s"]=$("#%1$s").DataTable(%2$s);})(window,jQuery); diff --git a/resources/views/vendor/flash/message.blade.php b/resources/views/vendor/flash/message.blade.php new file mode 100644 index 00000000..903c0239 --- /dev/null +++ b/resources/views/vendor/flash/message.blade.php @@ -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 +
+ @if(session()->has('flash_notification.important')) + + @endif + + {!! session('flash_notification.message') !!} +
+ @endif +@endif diff --git a/resources/views/vendor/flash/modal.blade.php b/resources/views/vendor/flash/modal.blade.php new file mode 100644 index 00000000..41b821c4 --- /dev/null +++ b/resources/views/vendor/flash/modal.blade.php @@ -0,0 +1,19 @@ + diff --git a/resources/views/vendor/notifications/email-plain.blade.php b/resources/views/vendor/notifications/email-plain.blade.php new file mode 100644 index 00000000..acefa652 --- /dev/null +++ b/resources/views/vendor/notifications/email-plain.blade.php @@ -0,0 +1,22 @@ + + + + + + + + + + + '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;', +]; +?> + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ + {{ config('app.name') }} + +
+ + + + +
+ +

+ @if ($level == 'error') + Whoops! + @else + Hello! + @endif +

+ + + @foreach ($introLines as $line) +

+ {{ $line }} +

+ @endforeach + + + @if (isset($actionText)) + + + + +
+ + + + {{ $actionText }} + +
+ @endif + + + @foreach ($outroLines as $line) +

+ {{ $line }} +

+ @endforeach + + +

+ Regards,
{{ config('app.name') }} +

+ + + @if (isset($actionText)) + + + + +
+

+ If you’re having trouble clicking the "{{ $actionText }}" button, + copy and paste the URL below into your web browser: +

+ +

+ + {{ $actionUrl }} + +

+
+ @endif +
+
+ + + + +
+

+ © {{ date('Y') }} + {{ config('app.name') }}. + All rights reserved. +

+
+
+
+ + diff --git a/resources/views/vendor/pagination/bootstrap-4.blade.php b/resources/views/vendor/pagination/bootstrap-4.blade.php new file mode 100644 index 00000000..3fe813a1 --- /dev/null +++ b/resources/views/vendor/pagination/bootstrap-4.blade.php @@ -0,0 +1,34 @@ +
    + + @if ($paginator->onFirstPage()) +
  • «
  • + @else +
  • + @endif + + + @foreach ($elements as $element) + + @if (is_string($element)) +
  • {{ $element }}
  • + @endif + + + @if (is_array($element)) + @foreach ($element as $page => $url) + @if ($page == $paginator->currentPage()) +
  • {{ $page }}
  • + @else +
  • {{ $page }}
  • + @endif + @endforeach + @endif + @endforeach + + + @if ($paginator->hasMorePages()) +
  • + @else +
  • »
  • + @endif +
diff --git a/resources/views/vendor/pagination/default.blade.php b/resources/views/vendor/pagination/default.blade.php new file mode 100644 index 00000000..1552cbca --- /dev/null +++ b/resources/views/vendor/pagination/default.blade.php @@ -0,0 +1,34 @@ +
    + + @if ($paginator->onFirstPage()) +
  • «
  • + @else +
  • + @endif + + + @foreach ($elements as $element) + + @if (is_string($element)) +
  • {{ $element }}
  • + @endif + + + @if (is_array($element)) + @foreach ($element as $page => $url) + @if ($page == $paginator->currentPage()) +
  • {{ $page }}
  • + @else +
  • {{ $page }}
  • + @endif + @endforeach + @endif + @endforeach + + + @if ($paginator->hasMorePages()) +
  • + @else +
  • »
  • + @endif +
diff --git a/resources/views/vendor/pagination/simple-bootstrap-4.blade.php b/resources/views/vendor/pagination/simple-bootstrap-4.blade.php new file mode 100644 index 00000000..878fcf92 --- /dev/null +++ b/resources/views/vendor/pagination/simple-bootstrap-4.blade.php @@ -0,0 +1,15 @@ +
    + + @if ($paginator->onFirstPage()) +
  • «
  • + @else +
  • + @endif + + + @if ($paginator->hasMorePages()) +
  • + @else +
  • »
  • + @endif +
diff --git a/resources/views/vendor/pagination/simple-default.blade.php b/resources/views/vendor/pagination/simple-default.blade.php new file mode 100644 index 00000000..dce63ebd --- /dev/null +++ b/resources/views/vendor/pagination/simple-default.blade.php @@ -0,0 +1,15 @@ +
    + + @if ($paginator->onFirstPage()) +
  • «
  • + @else +
  • + @endif + + + @if ($paginator->hasMorePages()) +
  • + @else +
  • »
  • + @endif +
diff --git a/routes/admin.php b/routes/admin.php new file mode 100644 index 00000000..78a25068 --- /dev/null +++ b/routes/admin.php @@ -0,0 +1,17 @@ + 'Admin', + //'middleware' => 'auth', + 'prefix' => 'admin', +], function () { + Route::resource('airlines', 'AirlinesController'); + Route::resource('aircraft', 'AircraftController'); +}); diff --git a/routes/web.php b/routes/web.php index 261b9a13..3fac7622 100755 --- a/routes/web.php +++ b/routes/web.php @@ -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'); }); - diff --git a/tests/AircraftTest.php b/tests/AircraftTest.php new file mode 100644 index 00000000..b95a7eb5 --- /dev/null +++ b/tests/AircraftTest.php @@ -0,0 +1,26 @@ +repo = $this->createRepository('AircraftRepository'); + } + /** + * A basic test example. + * + * @return void + */ + public function testRepository() + { + print_r($this->repo->model()); + } +} diff --git a/tests/TestCase.php b/tests/TestCase.php index 8208edca..219e0299 100755 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -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); + } }