i'm having the following issue on a projetct, i'm trying to retrieve some fields from a model and other specific fields from a child relationship, but when i use the ->select('id')
statement, it just retrieve the id
field from my parent model and all child relationships comes as null values, for example:
$someData = App\Book::with(['author:id,name,email', 'publisher:id,name,address'])->select('id')->get();
I just want to retrieve the book id; the author id, name and email fields and finally 'id, name and address' fields from the publisher table, this is clear? Can someone help me?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire