Redirect show() to edit()
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user