PHP code example of wmgbit / laravel-models-migration

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

    

wmgbit / laravel-models-migration example snippets


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

class ModelExample extends Model 
{

    function migration(Blueprint $table)
    {
        $table->id();
        $table->string('name');
        $table->string('email')->unique();
        $table->timestamp('email_verified_at')->nullable();
        $table->foreignId('user_id')->constrained();
        $table->unique(['name','user_id']);
        $table->rememberToken();
        $table->timestamps();
    }

}

php artisan migrate:models