-
-
Notifications
You must be signed in to change notification settings - Fork 20
Activatable model
Anton Komarev edited this page Mar 24, 2020
·
5 revisions
<?php
namespace App\Models;
use Cog\Flag\Traits\Classic\HasActiveFlag;
use Illuminate\Database\Eloquent\Model;
class Post extends Model
{
use HasActiveFlag;
}
Model must have boolean is_active
column in database table.
Post::all();
Post::withNotActivated()->get();
Post::withoutNotActivated()->get();
Post::onlyNotActivated()->get();
Post::whereKey(4)->activate();
Post::whereKey(4)->undoActivate();