From 365e33f5f81dddc744786efc6eb4004c7e402c92 Mon Sep 17 00:00:00 2001 From: Nabeel Shahzad Date: Tue, 6 Oct 2020 19:10:42 -0400 Subject: [PATCH] Redirect show() to edit() --- app/Http/Controllers/Admin/UserController.php | 34 +++---------------- 1 file changed, 4 insertions(+), 30 deletions(-) diff --git a/app/Http/Controllers/Admin/UserController.php b/app/Http/Controllers/Admin/UserController.php index 691266d7..74ecabb7 100644 --- a/app/Http/Controllers/Admin/UserController.php +++ b/app/Http/Controllers/Admin/UserController.php @@ -128,36 +128,7 @@ class UserController extends Controller */ public function show($id) { - $user = $this->userRepo->findWithoutFail($id); - - if (empty($user)) { - Flash::error('User not found'); - - return redirect(route('admin.users.index')); - } - - $pireps = $this->pirepRepo - ->whereOrder(['user_id' => $id], 'created_at', 'desc') - ->paginate(); - - $airlines = $this->airlineRepo->selectBoxList(); - $airports = $this->airportRepo->selectBoxList(false); - $countries = collect((new ISO3166())->all()) - ->mapWithKeys(function ($item, $key) { - return [strtolower($item['alpha2']) => $item['name']]; - }); - - return view('admin.users.show', [ - 'user' => $user, - 'pireps' => $pireps, - 'airlines' => $airlines, - 'timezones' => Timezonelist::toArray(), - 'country' => new ISO3166(), - 'countries' => $countries, - 'airports' => $airports, - 'ranks' => Rank::all()->pluck('name', 'id'), - 'roles' => Role::all()->pluck('name', 'id'), - ]); + $this->edit($id); } /** @@ -165,6 +136,8 @@ class UserController extends Controller * * @param int $id * + * @throws RepositoryException + * * @return mixed */ public function edit($id) @@ -193,6 +166,7 @@ class UserController extends Controller return view('admin.users.edit', [ 'user' => $user, 'pireps' => $pireps, + 'country' => new ISO3166(), 'countries' => $countries, 'timezones' => Timezonelist::toArray(), 'airports' => $airports,