diff --git a/app/Database/seeds/dev.yml b/app/Database/seeds/dev.yml index 5c344722..0803be30 100644 --- a/app/Database/seeds/dev.yml +++ b/app/Database/seeds/dev.yml @@ -18,11 +18,12 @@ users: rank_id: 1 home_airport_id: KAUS curr_airport_id: KJFK - flights: 1 + flights: 3 flight_time: 43200 + last_pirep_id: pirepid_3 + state: 1 created_at: now updated_at: now - state: 1 - id: 2 name: Carla Walters email: carla.walters68@example.com diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 8b5988a8..54e621d0 100755 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -2,6 +2,7 @@ namespace App\Exceptions; +use Log; use Exception; use Illuminate\Auth\AuthenticationException; use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; @@ -17,7 +18,7 @@ class Handler extends ExceptionHandler \Illuminate\Auth\AuthenticationException::class, \Illuminate\Auth\Access\AuthorizationException::class, \Symfony\Component\HttpKernel\Exception\HttpException::class, - \Illuminate\Database\Eloquent\ModelNotFoundException::class, + #\Illuminate\Database\Eloquent\ModelNotFoundException::class, \Illuminate\Session\TokenMismatchException::class, \Illuminate\Validation\ValidationException::class, ]; @@ -80,7 +81,10 @@ class Handler extends ExceptionHandler __DIR__ . '/views', ]); + Log::info('error status '. $status); + if (view()->exists("errors::{$status}")) { + #if (view()->exists('layouts' . config('phpvms.skin') .'.errors.' .$status)) { return response()->view("errors::{$status}", ['exception' => $e], $status, $e->getHeaders()); } else { return $this->convertExceptionToResponse($e); diff --git a/app/Http/Controllers/Frontend/DashboardController.php b/app/Http/Controllers/Frontend/DashboardController.php index 963bb387..20071025 100644 --- a/app/Http/Controllers/Frontend/DashboardController.php +++ b/app/Http/Controllers/Frontend/DashboardController.php @@ -2,12 +2,13 @@ namespace App\Http\Controllers\Frontend; +use Log; +use Illuminate\Support\Facades\Auth; + use App\Repositories\PirepRepository; use App\Repositories\UserRepository; -use Illuminate\Support\Facades\Auth; use App\Http\Controllers\AppBaseController; - class DashboardController extends AppBaseController { private $pirepRepo, $userRepo; @@ -28,10 +29,21 @@ class DashboardController extends AppBaseController $pireps = $this->pirepRepo->recent(); $users = $this->userRepo->recent(); + $last_pirep = null; + $user = Auth::user(); + + try { + $last_pirep = $this->pirepRepo->find($user->last_pirep_id); + } catch(\Exception $e) { + Log::info('No last PIREP for ' . $user->pilot_id); + } + + return $this->view('dashboard.index', [ - 'user' => Auth::user(), + 'user' => $user, 'pireps' => $pireps, 'users' => $users, + 'last_pirep' => $last_pirep, ]); } } diff --git a/resources/views/layouts/default/dashboard/index.blade.php b/resources/views/layouts/default/dashboard/index.blade.php index cedd3be1..7c241c55 100644 --- a/resources/views/layouts/default/dashboard/index.blade.php +++ b/resources/views/layouts/default/dashboard/index.blade.php @@ -22,7 +22,7 @@
-

{!! \App\Facades\Utils::secondsToTimeString($user->flight_time, false)!!}

+

{!! \App\Facades\Utils::minutesToTimeString($user->flight_time, false)!!}

total hours
@@ -41,17 +41,21 @@ + @if($last_pirep === null)
-
- -
- -
+
+ No reports yet. File one now.
+ @else + + @include('layouts.default.pireps.pirep_card', ['pirep' => $last_pirep]) + @endif