Support the ongoing development of Laravel.io →
Database Eloquent Packages
Last updated 2 years ago.
0

I found this when I was researching events a bit ago,

use Illuminate\Database\Eloquent\Relations\Pivot;

Pivot::creating(function($pivot) {
    $pivot->id = (string)$this->generateNewId();
});

From https://laracasts.com/discuss/channels/general-discussion/eloquent-attach-which-event-is-fired

Hope that helps.

0

Yeah, I posted that some time ago but the Pivot events also don't get fired when I use sync. On attach it worked on the problem I had in the thread but it doesn't work for sync.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

brnlbs brnlbs Joined 27 Aug 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.