chatbox-inc/laravel-transaction

1.0.3 2019-03-04 14:53 UTC

This package is auto-updated.

Last update: 2024-11-13 05:13:07 UTC


README

Latest Stable Version License

This - Laravel Transaction provide Auto Transaction to your Laravel Application.

Install

You can install via composer

$ composer require chatbox-inc/laravel-transaction

Usage

You can use middleware \Chatbox\LaravelTransaction\Http\Middleware\LaravelTransactionMiddleware.

if you load LaravelTransactionServiceProvider (normally auto discovered), you can use middleware alias transact_db .

Global Usage

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.