Closed rick20 closed 5 years ago
What does your relationship look like and how do you want to use save()
?
Sorry, my bad...I’ve solved it with 2 relationships
public function podcasts()
{
return $this->belongsToMany(Podcast::class)->using(Podcast::class)->withPivot('expired_at');
}
public function lastPodcast()
{
return $this->hasOneDeep(Podcast::class, [Subscription::class])->withIntermediate(Subscription::class, ['expired_at']);
}
$podcast = $user->lastPodcast;
// and
$user->podcasts()->attach(new Podcast());
Previously I used hasManyDeep() instead of belongsToMany()
Thank you for this package...really useful💪
When working on a simple hasManyDeep() relation, I'm unable to save() a new relation. I can see there's no InteractsWithPivotTable trait used by these relations. Would it be compatible to add mutating queries inside InteractsWithPivotTable to your relationships?