Fix pirep->ident
usage issues (#1347)
* Update table.blade.php * Update show.blade.php * Update pirep_card.blade.php * Update latest_pireps.blade.php * Update ProfileController.php Removed non used airports, added necessary relationships for eager loading. Also removed `fields` 'cause it is already being loaded when `fields.field` is used. No need to query it twice. * Update ProfileController.php
This commit is contained in:
parent
358f0b663e
commit
2dbe19fdcc
@ -80,7 +80,7 @@ class ProfileController extends Controller
|
||||
public function show($id)
|
||||
{
|
||||
/** @var \App\Models\User $user */
|
||||
$user = User::with(['awards', 'fields', 'fields.field'])
|
||||
$user = User::with('airline', 'awards', 'current_airport', 'fields.field', 'home_airport', 'last_pirep', 'rank')
|
||||
->where('id', $id)
|
||||
->first();
|
||||
|
||||
@ -89,13 +89,11 @@ class ProfileController extends Controller
|
||||
return redirect(route('frontend.dashboard.index'));
|
||||
}
|
||||
|
||||
$airports = $this->airportRepo->all();
|
||||
$userFields = $this->userRepo->getUserFields($user, true);
|
||||
|
||||
return view('profile.index', [
|
||||
'user' => $user,
|
||||
'userFields' => $userFields,
|
||||
'airports' => $airports,
|
||||
'acars' => $this->acarsEnabled(),
|
||||
]);
|
||||
}
|
||||
|
@ -2,8 +2,7 @@
|
||||
<div class="row">
|
||||
<div class="col-sm-10">
|
||||
<p>
|
||||
<a href="{{ route('frontend.pireps.show', [$pirep->id]) }}">
|
||||
{{ $pirep->airline->code }}{{ $pirep->ident }}</a>
|
||||
<a href="{{ route('frontend.pireps.show', [$pirep->id]) }}">{{ $pirep->ident }}</a>
|
||||
-
|
||||
{{ $pirep->dpt_airport->name }}
|
||||
(<a href="{{route('frontend.airports.show', [
|
||||
|
@ -4,8 +4,7 @@
|
||||
@section('content')
|
||||
<div class="row">
|
||||
<div class="col-sm-8">
|
||||
<h2>{{ $pirep->airline->icao }}{{ $pirep->ident }}
|
||||
: {{ $pirep->dpt_airport_id }} to {{ $pirep->arr_airport_id }}</h2>
|
||||
<h2>{{ $pirep->ident }} : {{ $pirep->dpt_airport_id }} to {{ $pirep->arr_airport_id }}</h2>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-4">
|
||||
|
@ -17,8 +17,7 @@
|
||||
@foreach($pireps as $pirep)
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{{ route('frontend.pireps.show', [
|
||||
$pirep->id]) }}">{{ $pirep->airline->code }}{{ $pirep->ident }}</a>
|
||||
<a href="{{ route('frontend.pireps.show', [$pirep->id]) }}">{{ $pirep->ident }}</a>
|
||||
</td>
|
||||
<td>
|
||||
@if($pirep->dpt_airport){{ $pirep->dpt_airport->name }}@endif
|
||||
|
@ -2,15 +2,15 @@
|
||||
@foreach($pireps as $p)
|
||||
<tr>
|
||||
<td style="padding-right: 10px;">
|
||||
<span class="title">{{ $p->airline->code }} {{ $p->flight_number }}</span>
|
||||
<span class="title">{{ $p->ident }}</span>
|
||||
</td>
|
||||
<td>
|
||||
<a href="{{route('frontend.airports.show', [$p->dpt_airport_id])}}">{{$p->dpt_airport_id}}</a>
|
||||
-
|
||||
<a href="{{route('frontend.airports.show', [$p->arr_airport_id])}}">{{$p->arr_airport_id}}</a>
|
||||
@if(!empty($p->aircraft))
|
||||
{{ optional($p->aircraft)->registration }} ({{ $p->aircraft->icao }})
|
||||
@endif
|
||||
<a href="{{route('frontend.airports.show', [$p->arr_airport_id])}}">{{$p->arr_airport_id}}</a>
|
||||
</td>
|
||||
<td>
|
||||
{{ optional($p->aircraft)->ident }}
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
|
Loading…
Reference in New Issue
Block a user