PHP code example of netcreaties / laravel-synchronize

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

    

netcreaties / laravel-synchronize example snippets


    public function __construct()
    {
        Event::listen(MigrationStarted::class, function (MigrationStarted $listener) {
            if ($listener->migration instanceof $this && $listener->method === 'up') {
                Artisan::call('synchronize --class=TestASync --force');
                echo Artisan::output();
            }
        });
    }
shell
php artisan vendor:publish --provider="LaravelSynchronize\Providers\ServiceProvider" --tag="config"
shell
php artisan vendor:publish --provider="LaravelSynchronize\Providers\ServiceProvider" --tag="migrations"
shell
php artisan migrate
shell
php artisan synchronize