How is thinkphp5 designed to use transactions?

is it better to put the transaction in the controller, or in the model, or is there another solution when using TP5 when you need a transaction? If you put it in a model, and multiple models are involved in the process, and the process requires a transaction, and the transaction in each model is successful, the transaction of the process will not be committed until it is successful. For example, the background administrator makes an operation, and if the operation is successful, the operation is written to the operation log. In the model of the operation, the transaction is successful, but when it is written to the log, it fails, and the whole operation is rolled back.

Mar.04,2021

1. When it comes to multiple models, you can just use the Db class
2. Log writes generally do not fail

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea4bec-46a42.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea4bec-46a42.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?