This - Laravel Transaction provide Auto Transaction to your Laravel Application.
You can install via composer
$ composer require chatbox-inc/laravel-transaction
You can use middleware \Chatbox\LaravelTransaction\Http\Middleware\LaravelTransactionMiddleware
.
if you load LaravelTransactionServiceProvider
(normally auto discovered),
you can use middleware alias transact_db
.
If you need transaction to your all routes,
add middleware in the $middleware
property of app/Http/Kernel.php
protected $middleware = [
// ...
\Chatbox\LaravelTransaction\Http\Middleware\LaravelTransactionMiddleware::class
];
or you can apply it to middleware group by using $middlewareGroups
property .
protected $middlewareGroups = [
// ...
'api' => [
// ...
\Chatbox\LaravelTransaction\Http\Middleware\LaravelTransactionMiddleware::class
],
];
With LaravelTransactionServiceProvider
(normally auto discovered), you can use alias transact_db
.
protected $middlewareGroups = [
// ...
'api' => [
// ...
"transact_db"
],
];
Of caurse, you can use this middleware per route if you need.