-
-
Notifications
You must be signed in to change notification settings - Fork 20
Closable model
Anton Komarev edited this page Mar 19, 2019
·
3 revisions
<?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::withClosed();Post::withoutClosed();Post::onlyClosed();Post::whereKey(4)->close();Post::whereKey(4)->undoClose();