In case this is only example, you need to do input validation and that solves your problem. (see manual)
In case that this are real tables merge them.
I would use 'transactions'. They were designed just for such cases.
http://laravel.com/docs/5.0/database (chapter 'Database Transactions')
Sign in to participate in this thread!
We'd like to thank these amazing companies for supporting us
The Laravel portal for problem solving, knowledge sharing and community building.