Database transaction middleware for Laravel
cannonsir/laravel-transaction-middleware is a Laravel package for database transaction middleware for laravel.
It currently has 4 GitHub stars and 275 downloads on Packagist (latest version 2.0.0).
Install it with composer require cannonsir/laravel-transaction-middleware.
Discover more Laravel packages by cannonsir
or browse all Laravel packages to compare alternatives.
Last updated
This is a middleware used to open database transactions in the request. If an exception is thrown during the request execution, the SQL statements executed in the whole request will be rolled back
You just need to use
transactionmiddleware
Using Middleware in routing
Route::middleware('transaction')->resource('users', 'UserController');
Using middleware in the controller constructor
public function __construct()
{
$this->middleware('transaction');
}
>= 5.5$ composer require cannonsir/laravel-transaction-middleware
$ composer remove cannonsir/laravel-transaction-middleware
MIT License. See the LICENSE file.