Load the user airline/bid ahead of time; SB XML name fix

This commit is contained in:
Nabeel Shahzad 2020-03-24 16:17:28 -04:00
parent 3f7a7d0f2e
commit 62cea3eb0c
2 changed files with 9 additions and 5 deletions

View File

@ -77,7 +77,7 @@ class UserController extends Controller
*/
public function index(Request $request)
{
return new UserResource(Auth::user());
return $this->get(Auth::user()->id);
}
/**
@ -89,7 +89,11 @@ class UserController extends Controller
*/
public function get($id)
{
return new UserResource($this->userRepo->find($id));
$user = $this->userRepo
->with(['airline', 'bids'])
->find($id);
return new UserResource($user);
}
/**

View File

@ -37,10 +37,10 @@ class SimBriefXML extends SimpleXMLElement
$base_url = $this->fms_downloads->directory;
// TODO: Put vmsACARS on top
if (!empty($this->fms_downloads->vma)) {
if (!empty($this->fms_downloads->vms)) {
$fps[] = [
'name' => $this->fms_downloads->vma->name->__toString(),
'url' => $base_url.$this->fms_downloads->vma->link,
'name' => $this->fms_downloads->vms->name->__toString(),
'url' => $base_url.$this->fms_downloads->vms->link,
];
}