AngularAngularAngular
AngularAngularAngular

Reputation: 3769

How can i get the last insert id in the create:: in laravel

How can i get the last inserted id in the laravel. I am using the given below eloquent way to insert the record

OutSideCity::create($Tariff3Data);

How can i get the last insert id for the above query ?

If i use

$FreshTripEntry->save();

I can get the Lastinsert id by $Lastid = $FreshTripEntry->id;

But how can i get the last insert id for the OutSideCity::create($Tariff3Data); ?

Upvotes: 1

Views: 135

Answers (1)

Deenadhayalan Manoharan
Deenadhayalan Manoharan

Reputation: 5444

Try this..

$Traiff=OutSideCity::create($Tariff3Data);

$insertedId = $Traiff->id;

Upvotes: 2

Related Questions