Please refer to the collection object data as attached. My code is as below:
$products = $searchResultQuery->with(['child','combovariant','thumbnail'])->where('view',1)->get();
now the condition I intend to achieve is when list_price is less than cost_price then $products should contain only records that meet the condition. Otherwise when list_price is equal to cost_price then $products should only contain records that meet the condition.
Now when you look at the collection object data you would see that combovariant has one or many onevariant. Each onevariant has list_price and cost_price. Now you are required to sum up the list_price and cost_price for each onevariant into a total list_price and cost_price. Then do the comparison based on the suggested condition and decide which record should be in $products. Example:
$q->whereColumn('list_price',($filter) ? '<' : '=', 'cost_price');
10 freelancere byder i gennemsnit $27 timen for dette job
Hello, I Have Read your Requirement. I have expert in Laravel. I have experience in 6+ Year in developing. It's glad for us to work with you. Thanks Girish Vadher
hii , i am 3 year experience in laravel. i solve your problem easily. and i m new in freelnacing so my price is down. if you interest to work with me please come on chat.