PHP code example of laravel-enso / lockable-models

1. Go to this page and download the library: Download laravel-enso/lockable-models library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

laravel-enso / lockable-models example snippets


return [
    'lock_duration' => 5,
];

use LaravelEnso\LockableModels\Models\LockableModel;

class Order extends LockableModel
{
}

use LaravelEnso\LockableModels\Models\ModelLock;

class OrderLock extends ModelLock
{
}

Route::middleware([
    PreventActionOnLockedModels::class,
    UnlocksModelOnTerminate::class,
])->group(function () {
    // edit routes
});

$order->lockFor($user);
$order->unlockFor($user);
bash
php artisan vendor:publish --tag=lockable-models-config