The issue with laravel rollback, that the id is always incremented even the multiple insertion in the DB is failed.
For example, i am using laravel transaction to insert two models. The model 1 latest id is 5, and the model 2 latest id is 10, when the normal tranaction start, the result will be that the inserted object from model 1 is 6 and for the model 2 is 11.
For the second insertion, the model 1 is inserted and the new id is 7, but the model 2 insertion is failed, so it will rollback, but the next insertion for model 1 will be 9 and not 8 even it is failed.
Ok, the problem is that the id in the DB(Mysql, engine innoDB) is incremented, but it must be a solution when it is rolledback the id too.
Does any one have any idea how to resolve this issue ? Thank you.