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

I modified the code from the post a little :

$pivot_id = $form->persons()->where("persons.id", "=",$person->id)->withPivot("id")->orderBy('pivot_created_at', 'desc')->first()->pivot->id;

Then i get the latest inserted pivot_id

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Bolandish bolandish Joined 2 Jun 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.