You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hands up this will totally be my issue but I can't quite work out why. (new to Laravel).
I've setup both traits on my BookingFamilyMember Model:
use HasBelongsToManyEvents;
use HasRelationshipObservables;
And set the boot on the model as described
static::belongsToManyAttaching(function ($relation, $parent, $ids) {
Log::debug("Attaching to member {$parent->name}. ");
});
And in my BookingFamilyMemberObserver I have this:
public function belongsToManyAttaching($relation,BookingFamilyMember $member,$ids)
{
dump($relation);
}
Now in your example you show $relation being tied to Model.. however if I do that it fails.. My relation return "journeys"
Which is how it's being attached:
$member->journeys()->attach(1);
Is that all good - or am I missing something by loosely attaching it like this for a ManytoMany?
It works.. I just didn't want to miss something obvious if it should be tied to a Model.
Thank you!
The text was updated successfully, but these errors were encountered:
Hands up this will totally be my issue but I can't quite work out why. (new to Laravel).
I've setup both traits on my BookingFamilyMember Model:
And set the boot on the model as described
And in my BookingFamilyMemberObserver I have this:
Now in your example you show $relation being tied to Model.. however if I do that it fails.. My relation return "journeys"
Which is how it's being attached:
$member->journeys()->attach(1);
Is that all good - or am I missing something by loosely attaching it like this for a ManytoMany?
It works.. I just didn't want to miss something obvious if it should be tied to a Model.
Thank you!
The text was updated successfully, but these errors were encountered: