1
        $doc->user_id = Auth::getUser()->id;;
        $doc->type = post('type');
        $doc->list_num = post('list_num');
        $doc->ticket = post('ticket');
        $doc->contract = post('contract');
        $doc_id = $doc->save();

I want to take last added modele id from database. How I can do this?

Titamik
  • 39
  • 6

1 Answers1

2
...
$doc_id = $doc->save();
$doc_id  = $doc->id; //id is the primary id you set in model, default is id
YGYG
  • 126
  • 1
  • 5