Take a look at this: http://stackoverflow.com/questions/22562121/get-the-id-of-the-last-attached-model
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
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community