Closed erycson-cubo closed 7 months ago
I solved it using the following method:
public function products()
{
return $this->belongsToMany(Product::class, ProductSubscription::class)
->join('subscriptions', 'subscriptions.id', 'product_subscription.subscription_id');
}
I have a specific situation, which I try to exemplify with the code below. What I'm trying to do is use a specific "localKeyLookup" for my alias, but unfortunately I couldn't, I would like to know if there is any way to solve this problem in a more elegant way
For now, I tried to solve the problem like this, but it didn't work::
My database has these relationships, and my intention is, from the user, to obtain all the products that he has subscribed to directly, remembering that I need to go through the subscriptions table to be able to obtain the current valid subscription: