cannonsir / laravel-transaction-middleware
Database transaction middleware for Laravel
Installs: 274
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 0
Forks: 1
Open Issues: 0
pkg:composer/cannonsir/laravel-transaction-middleware
Requires
- laravel/framework: ~5.5 || ~6.0 || ~7.0
README
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
Usage
You just need to use
transaction
middleware
Using Middleware in routing
Route::middleware('transaction')->resource('users', 'UserController');
Using middleware in the controller constructor
public function __construct() { $this->middleware('transaction'); }
Requirements
- laravel
>= 5.5
Install
$ composer require cannonsir/laravel-transaction-middleware
Uninstall
$ composer remove cannonsir/laravel-transaction-middleware
License
MIT License. See the LICENSE file.