laravel migration type data code example

Example 1: how to make-migrations in laravel

php artisan make:migration create_users_table --create=users

php artisan make:migration add_votes_to_users_table --table=users

Example 2: laravel drop table migration

Schema::drop('users');

Schema::dropIfExists('users');

Example 3: migrations required field laravel

$table->string('foo')->nullable(false)->change();

Example 4: migrate to an existing table in laravel commad

public function up()
{
    Schema::table('users', function($table) {
        $table->integer('paid');
    });
}

Tags:

Php Example