I have an Order module, In which relationship for customer is as, public function customer() {
return $this->hasOne(Customer::class, 'id', 'customer_id');
}
My query to fetch order details is as, $orderResponse = Order::find(1);
My Order Resource consists, 'customer' => new CustomerResource($this->whenLoaded('customer'))
So, expected result is I should get all customer details without customer object as I not load it while fetching order data. But it coming in response. While loading collections it is working fine but not for hasOne relationship.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire