Closed mRamadan0101 closed 4 years ago
Use this relationship:
public function order_details_extra()
{
return $this->hasManyDeep(
'App\Models\ExtraItems',
['App\Models\OrderDetails', 'order_details_extra_items']
);
}
need to defined column 'order_details_id','extra_items_id' where
This shouldn't be necessary, you are using the Laravel conventions for naming columns.
Do you get an error?
no error but no data added
What does your query look like?
$form->multipleSelect('order_details_extra', 'Extra Items')->options(ExtraItems::all()->pluck('title', 'id'));
Where does multipleSelect()
come from?
Laravel Admin https://laravel-admin.org/docs
$form->multipleSelect($column[, $label])->options([1 => 'foo', 2 => 'bar', 'val' => 'Option name']);
Please try a simple query like dd(Order::find($id)->order_details_extra);
first.
null
i add manual data and displayed dd(Order::find($id)->order_details_extra);
What's the result of dd(Order::find($id)->order_details_extra());
?
too many data started from order_details
i have 3 table and want to make relation between them
order: id,total
order_details: order_id dish_name
extra_items id title
order_details_extra_items order_details_id extra_items_id
how can make relation between them in Order Model؟ i try to use this function