-
-
Notifications
You must be signed in to change notification settings - Fork 20
Closable model
Pe Ell edited this page Apr 17, 2017
·
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::withoutClosed();Post::onlyClosed();Post::withClosed();Post::where('id', 4)->close();Post::where('id', 4)->open();