-
-
Notifications
You must be signed in to change notification settings - Fork 21
Expirable model
Anton Komarev edited this page Mar 19, 2019
·
3 revisions
<?php
namespace App\Models;
use Cog\Flag\Traits\Inverse\HasExpiredFlag;
use Illuminate\Database\Eloquent\Model;
class Post extends Model
{
use HasExpiredFlag;
}
Model must have boolean is_expired
column in database table.
<?php
namespace App\Models;
use Cog\Flag\Traits\Classic\HasExpiredAt;
use Illuminate\Database\Eloquent\Model;
class Post extends Model
{
use HasExpiredAt;
}
Model must have nullable timestamp expired_at
column in database table.
Post::all();
Post::withExpired();
Post::withoutExpired();
Post::onlyExpired();
Post::whereKey(4)->expire();
Post::whereKey(4)->undoExpire();