cannonsir/laravel-transaction-middleware

There is no license information available for the latest version (2.0.0) of this package.

Database transaction middleware for Laravel

2.0.0 2020-03-13 14:21 UTC

This package is auto-updated.

Last update: 2024-10-21 16:07:58 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License

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.