Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Laravel, get last insert id using Eloquent

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 1.29k
    Comment on it

    Laravel 4.x we have a facility to get last inserted id easily. By showing one of my code you will get easily understanding.

    Example:

      $karmaNote = new Karmanote;
       $karmaNote ->reqid             = $meetingId;
       $karmaNote ->connectionidgGiver= $connectionId;
       $karmaNote ->useridReceiver    = $userId;
       $karmaNote ->details           = $description;
       $karmaNote ->viewstatus        = 0;
       $karmaNote->created_at     = KarmaHelper::currentDate();
       $karmaNote->save();
       $karmaNoteId = $karmaNote->id;
    

    Here $karmaNoteId is the last insert id in database.

    By this we can find last inserted id.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: