-
-
Notifications
You must be signed in to change notification settings - Fork 21
Expirable model
Pe Ell edited this page Apr 17, 2017
·
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::withoutExpired();
Post::onlyExpired();
Post::withExpired();
Post::where('id', 4)->expire();
Post::where('id', 4)->unexpire();