-
-
Notifications
You must be signed in to change notification settings - Fork 20
Usage
Pe Ell edited this page Apr 17, 2017
·
11 revisions
public function up()
{
Schema::create('post', 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.
public function up()
{
Schema::create('post', 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.
<?php
namespace App\Models;
use Cog\Flag\Traits\Inverse\HasClosedFlag;
use Illuminate\Database\Eloquent\Model;
class Post extends Model
{
use HasClosedFlag;
}Model must have boolean is_closed column in database table.
<?php
namespace App\Models;
use Cog\Flag\Traits\Classic\HasClosedAt;
use Illuminate\Database\Eloquent\Model;
class Post extends Model
{
use HasClosedAt;
}Model must have nullable timestamp closed_at column in database table.
Post::all();
Post::withoutClosed();Post::onlyClosed();Post::withClosed();Post::where('id', 4)->close();Post::where('id', 4)->open();