L
L
lynnikvadim2015-09-13 00:47:28
Laravel
lynnikvadim, 2015-09-13 00:47:28

How to get id of added post in Laravel?

How to get the id of a newly added entry in Laravel ?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
lynnikvadim, 2015-09-13
@lynnikvadim

Found a solution:

$OrgModel->save();        
$t=$OrgModel->id;

P
Pavel Zhukau, 2015-09-13
@NikesDark

Well, it's still a little easier.
$array - array of values ​​for news, for example title,body,description keys with values

$new_article = Article::create($array);
$new_article->id

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question