PHP code example of shibuyakosuke / laravel-ddl-export

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

    

shibuyakosuke / laravel-ddl-export example snippets




use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->id()->comment('ID');
            $table->string('name')->comment('氏名');
            $table->string('email')->unique()->comment('メールアドレス');
            $table->timestamp('email_verified_at')->nullable()->comment('メール認証日時');
            $table->string('password')->comment('パスワード');
            $table->rememberToken()->comment('リメンバートークン');
            $table->dateTime('created_at')->nullable()->comment('作成日時');
            $table->dateTime('updated_at')->nullable()->comment('更新日時');
            $table->softDeletes()->comment('削除日時');
            $table->tableComment('ユーザー');
        });
    }
};

return [
    'users' => [
        'id' => ['integer', '       'email' => ['string', ', '['date', 'nullable'],
        'updated_at' => ['date', 'nullable'],
        'deleted_at' => ['date', 'nullable'],
    ],
];

return [
    'users' => [
        'id' => 'ID',
        'name' => '氏名',
        'email' => 'メールアドレス',
        'email_verified_at' => 'メール認証日時',
        'password' => 'パスワード',
        'remember_token' => 'リメンバートークン',
        'created_at' => '作成日時',
        'updated_at' => '更新日時',
        'deleted_at' => '削除日時',
    ],
];
bash
$ php artisan migrate
$ php artisan ddl:export
bash
$ php artisan ddl:rules
bash
$ php artisan ddl:trans