PHP code example of astrotomic / laravel-transaction-proxy
1. Go to this page and download the library: Download astrotomic/laravel-transaction-proxy library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
astrotomic / laravel-transaction-proxy example snippets
use Astrotomic\LaravelTransactionProxy\HasTransactionalCalls;
class MyClass
{
use HasTransactionalCalls;
}
$model->transaction()->delete();
// vs
use Illuminate\Support\Facades\DB;
DB::transaction(fn() => $model->delete());
$model->transaction(function(Model $model) {
$model->update();
$model->child->update();
});