Level 11
@malinga91 you can also create a one more pivot table hotel_order table and get the value from there
I'm working on a project which include shopping cart. Basic requirement is,
Current database structure is,
stores
- id
- name
products
- id
- store_id
- name
- amount
orders
- id
- customer_name
- address
- cart_total
order_products
- id
- order_id
- product_id
- price
//
Hotel Model
public function order_products()
{
return $this->hasManyThrough('App\OrderProduct', 'App\Product');
}
How to write App\Hotel model to get order details? Should I add column('hotel_id') in order_products table?
Please or to participate in this conversation.