I've tried a lot and following logic is the closest.
// App\Models\Product
public function sale() {
return $this->belongsToThrough('App\Models\Sale', 'App\Models\SaleProduct', null, '', [
'App\Models\SaleProduct' => 'idx_sale_product',
'App\Models\Sale' => 'idx_sale',
]);
}
However, the result of the query execution is not what I wanted.
select `sale`.* from `bp_sale`
left join `sale_product` on `sale`.`idx_sale` = `sale_product`.`idx_sale`
left join `product` on `sale_product`.`idx_sale` = `product`.`idx_sale_product`
How can i change sale_product.idx_sale to sale_product.idx_sale_product ? (third line)
It's too harsh for me
I've tried a lot and following logic is the closest.
However, the result of the query execution is not what I wanted.
How can i change
sale_product
.idx_sale
tosale_product
.idx_sale_product
? (third line) It's too harsh for me