samedi 7 janvier 2017

After create - why does it not return relationship?

When creating an entry using create() - Why doesit return a relationship of pilot_id table instead of just showing pilot id?

For example, in the repository class:

public function createFlight()
  $flight = App\Flight::create([
     'name' => 'Flight 10'
     'pilot_id' => 4
  ]);

  return $flight;
}

In the controller:

public function show()
{
   $data = $this->flight->createFlight();
   return $data
}

It would return json on the screen but it is not showing the relationship table (pilot) of pilot_id.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2ioPPTB
via IFTTT

Aucun commentaire:

Enregistrer un commentaire