PHP code example of dentro / laravel-patcher

1. Go to this page and download the library: Download dentro/laravel-patcher 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/ */

    

dentro / laravel-patcher example snippets




use Dentro\Patcher\Patch;

class WhatDoYouWantToPatch extends Patch
{
    public function patch()
    {
        // 
    }
}

    > $this->command->warn('i patch something danger!');
    > $this->command->confirm('do you wish to continue?');
    > 

    > [
    >     'channels' => [
    >         'patcher' => [
    >              'driver' => 'patcher', // you can change me if you want
    >              'path' => storage_path('logs/patches.log'), // change me
    >          ],
    >     ],
    > ];
    > 
 artisan patcher:run



use Dentro\Patcher\Patch;
use App\Models\User;

class WhatDoYouWantToPatch extends Patch
{
    public function eligible(): bool
    {
        return User::query()->where('id', 331)->exists();
    }
    
    public function patch()
    {
        $user = User::query()->find(331);
        // do something with user.
    }
}
 artisan patcher:run

class WhatDoYouWantToPatch extends Patch
{
    public bool $isPerpetual = true;
}
shell script
 php artisan patcher:install
shell script
php artisan patcher:status
shell script
➜ php artisan patcher:status
+------+---------------------------------------+-------+
| Ran? | Patch                                 | Batch |
+------+---------------------------------------+-------+
| Yes  | 2020_09_29_190531_fix_double_sections | 1     |
| Yes  | 2020_10_09_124616_add_attachment_beep | 1     |
+------+---------------------------------------+-------+
shell script
php artisan patcher:run