PHP code example of websolutionfalcon / lockable-command

1. Go to this page and download the library: Download websolutionfalcon/lockable-command 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/ */

    

websolutionfalcon / lockable-command example snippets




namespace App\Console\Commands;

use Websolutionfalcon\LockableCommand\Commands\LockableCommand;

class ProcessReports extends LockableCommand
{
    protected $signature = 'reports:process';
    protected $description = 'Process pending reports';

    public function handle()
    {
        $this->info('Processing reports...');
        // Your command logic here
    }
}

return [
    // Directory where lock files are stored
    'lock_path' => env('LOCKABLE_COMMAND_LOCK_PATH', storage_path('app/tmp')),

    // File extension for lock files
    'lock_extension' => env('LOCKABLE_COMMAND_LOCK_EXTENSION', '.lock'),
];
bash
php artisan vendor:publish --tag="lockable-command-config"
bash
php artisan command:locker lock reports:process
bash
php artisan command:locker unlock reports:process
bash
php artisan command:locker lock reports:process
php artisan command:locker unlock reports:process