1-- For mysql
2INSERT INTO table_name (col1, col2,...) VALUES ('val1', 'val2'...);
3SELECT LAST_INSERT_ID();
1-- To get the last inserted auto-increment row ID: --
2SELECT LAST_INSERT_ID( optional_expression )
3
4-- If you have just inserted it using a command in C# use: --
5int lastId = (Int32)yourCommand.LastInsertedId;
1//laravel controller
2$newOrder = new Order();
3...
4...
5$newOrder->save();
6
7$last_id = $newOrder->id;