- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 20
 
Activatable model
        Pe Ell edited this page Apr 17, 2017 
        ·
        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::withoutDeactivated();Post::onlyDeactivated();Post::withDeactivated();Post::where('id', 4)->activate();Post::where('id', 4)->deactivate();