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.
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.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community