vendredi 26 octobre 2018

How get all data from orders with files?

I have table with orders where is id as a key and order name. Next table is files with id, order_id, url What i need to do is get all order with list of files. and in my order class i have

public function files() {
    return $this->hasMany('App\File', 'id', 'order_id');
}

When i get order $order = Order::find(82) my $order->files is null. Do i need to add something else ?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire