From 807ac69ae93ab99f172185f435611ede21f0c699 Mon Sep 17 00:00:00 2001 From: Nabeel Shahzad Date: Tue, 8 Aug 2017 20:34:36 -0500 Subject: [PATCH] #21 list user's pireps --- .../Controllers/Frontend/PirepController.php | 15 ++++- resources/views/layouts/default/app.blade.php | 2 +- .../layouts/default/pireps/index.blade.php | 17 ++++++ .../layouts/default/pireps/table.blade.php | 56 +++++++++++++++++++ routes/web.php | 2 + 5 files changed, 90 insertions(+), 2 deletions(-) create mode 100644 resources/views/layouts/default/pireps/table.blade.php diff --git a/app/Http/Controllers/Frontend/PirepController.php b/app/Http/Controllers/Frontend/PirepController.php index e1de4cbe..6ca2df18 100644 --- a/app/Http/Controllers/Frontend/PirepController.php +++ b/app/Http/Controllers/Frontend/PirepController.php @@ -5,6 +5,8 @@ namespace App\Http\Controllers\Frontend; use Illuminate\Support\Facades\Auth; use App\Http\Controllers\AppBaseController; +use App\Models\Pirep; + class PirepController extends AppBaseController { @@ -15,8 +17,19 @@ class PirepController extends AppBaseController */ public function index() { + $user = Auth::user(); + $pireps = Pirep::where('user_id', $user->id) + ->orderBy('created_at', 'desc') + ->get(); + return $this->view('pireps.index', [ - 'user' => Auth::user(), + 'user' => $user, + 'pireps' => $pireps, ]); } + + public function create() + { + return view('pireps.create'); + } } diff --git a/resources/views/layouts/default/app.blade.php b/resources/views/layouts/default/app.blade.php index b254bb67..2fcfd349 100644 --- a/resources/views/layouts/default/app.blade.php +++ b/resources/views/layouts/default/app.blade.php @@ -54,7 +54,7 @@