Question and answer is powered by AnsPress.io
If you are using Laravel Eloquent method, then it will be helpful for you.
Apply it:
<?php $data = Tbl_MyTable::create([ 'name' => $request->name, 'status' => '1' ]); if($data) { $last_id = $data->id; } echo $last_id; ?>