Show awards on user profile #703 (#866)

This commit is contained in:
Nabeel S
2020-10-11 16:06:09 -04:00
committed by GitHub
parent 151f188886
commit 193fbd369d
16 changed files with 172 additions and 62 deletions

View File

@@ -61,27 +61,14 @@ class ProfileController extends Controller
}
/**
* Redirect to show() since only a single page gets shown and the template controls
* the other items that are/aren't shown
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function index()
{
/** @var User $user */
$user = Auth::user();
if (setting('pilots.home_hubs_only')) {
$airports = $this->airportRepo->findWhere(['hub' => true]);
} else {
$airports = $this->airportRepo->all();
}
$userFields = $this->userRepo->getUserFields($user);
return view('profile.index', [
'acars' => $this->acarsEnabled(),
'user' => $user,
'airports' => $airports,
'userFields' => $userFields,
]);
return $this->show(Auth::user()->id);
}
/**
@@ -91,7 +78,8 @@ class ProfileController extends Controller
*/
public function show($id)
{
$user = User::with(['fields', 'fields.field'])
/** @var \App\Models\User $user */
$user = User::with(['awards', 'fields', 'fields.field'])
->where('id', $id)
->first();