elect last id code example
Example 1: get last inserted primary key
INSERT INTO dbo.Table(columns)
OUTPUT INSERTED.p_key, INSERTED.someothercolumnhere .......
VALUES(...)
Example 2: find last id
//laravel controller
$newOrder = new Order();
...
...
$newOrder->save();
$last_id = $newOrder->id;