Skip to content
Anton Komarev edited this page Sep 9, 2017 · 11 revisions

Prepare database

Boolean flag

public function up()
{
    Schema::create('posts', function (Blueprint $table) {
        $table->increments('id');
        $table->string('title');
        $table->boolean('is_published');
        $table->timestamps();
    });
}

Change is_published on any other Boolean flag database column name.

Timestamp flag

public function up()
{
    Schema::create('posts', function (Blueprint $table) {
        $table->increments('id');
        $table->string('title');
        $table->timestamp('published_at')->nullable();
        $table->timestamps();
    });
}

Change published_at on any other Timestamp flag database column name.

Flags usage examples