Redirect show() to edit()
This commit is contained in:
@@ -128,36 +128,7 @@ class UserController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function show($id)
|
public function show($id)
|
||||||
{
|
{
|
||||||
$user = $this->userRepo->findWithoutFail($id);
|
$this->edit($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'),
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -165,6 +136,8 @@ class UserController extends Controller
|
|||||||
*
|
*
|
||||||
* @param int $id
|
* @param int $id
|
||||||
*
|
*
|
||||||
|
* @throws RepositoryException
|
||||||
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function edit($id)
|
public function edit($id)
|
||||||
@@ -193,6 +166,7 @@ class UserController extends Controller
|
|||||||
return view('admin.users.edit', [
|
return view('admin.users.edit', [
|
||||||
'user' => $user,
|
'user' => $user,
|
||||||
'pireps' => $pireps,
|
'pireps' => $pireps,
|
||||||
|
'country' => new ISO3166(),
|
||||||
'countries' => $countries,
|
'countries' => $countries,
|
||||||
'timezones' => Timezonelist::toArray(),
|
'timezones' => Timezonelist::toArray(),
|
||||||
'airports' => $airports,
|
'airports' => $airports,
|
||||||
|
|||||||
Reference in New Issue
Block a user