Support the ongoing development of Laravel.io →
posted 4 years ago
Laravel
Last updated 2 years ago.
1

Just return the result when you query and you could get the id of that INSERT.

0

Post::latest()->first()->min('id');

0

I use the following:

    $main = new yourtablename(array(
        'userID' => $this->theUserID,
        'userName' => encrypt($request->unameName)));
   $main->save()
   $main->id;

I am sure there are other ways, this is what I am currently using.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

pakainfo pakainfo Joined 3 Apr 2020

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.