PHP code example of bastinald / laravel-automatic-migrations

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

    

bastinald / laravel-automatic-migrations example snippets


namespace App\Models;

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Eloquent\Model;

class MyModel extends Model
{
    public function migration(Blueprint $table)
    {
        $table->id();
        $table->string('name');
        $table->timestamp('created_at')->nullable();
        $table->timestamp('updated_at')->nullable();
    }
}
 

class MyModel extends Model
{
    public $migrationOrder = 1;

    public function migration(Blueprint $table)
    {
        $table->id();
        $table->string('name');
        $table->timestamp('created_at')->nullable();
        $table->timestamp('updated_at')->nullable();
    }
}

'stub_path' => resource_path('stubs/vendor/laravel-automatic-migrations'),
console
php artisan make:amodel {class} {--force}
console
php artisan migrate:auto {--f|--fresh} {--s|--seed} {--force}
console
php artisan vendor:publish --tag=laravel-automatic-migrations