In a laravel project, in a controller im trying to show the comments and the files from database
my fuction goes like this
public function show($id)
{
// with('comments')->
$shipment = Shipment::with('comments')->where('id','=', $id)->first();
// $shipment = Shipment::with('files')->where('id','=',$id)->first();
return response()->json($shipment);
}
I commented the file row because it was bringing me or the files or the comments, not both, and I need to retrieve the two arrays in the shipment object.
How can I add the files and the comments to shipment?
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2udum53
via IFTTT
Aucun commentaire:
Enregistrer un commentaire