PHP code example of muhammadhuzaifa / laravel-safe-migration

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

    

muhammadhuzaifa / laravel-safe-migration example snippets


return [
    /*
    |--------------------------------------------------------------------------
    | Safe Migration Enabled
    |--------------------------------------------------------------------------
    |
    | This value enable or disable the package functionality.
    |
    */

    "safe_migration_enabled" => env('SAFE_MIGRATION_ENABLED', true),
    /*
    |--------------------------------------------------------------------------
    | Commands To Monitor
    |--------------------------------------------------------------------------
    |
    | This value determined which commands package should listen to
    | make database backup before executing it.
    |
    */

    "commands_to_monitor" => [
        "migrate",
        'migrate:fresh',
        'migrate:refresh',
        'migrate:reset',
        'migrate:rollback',
    ],

    /*
    |--------------------------------------------------------------------------
    | Stop On Fail
    |--------------------------------------------------------------------------
    |
    | This value determined whether the migration should continue or not if the
    | backup creation fail.
    |
    */

    "stop_on_fail" => true,

    /*
    |--------------------------------------------------------------------------
    | Filename
    |--------------------------------------------------------------------------
    |
    | You can set the filename here. Timestamp and the extension will be appended
    | during the generation of the backup.
    |
    */

    "filename" => "safe-migration",
];
bash
php artisan vendor:publish --tag="safe-migration-config"