-
-
Notifications
You must be signed in to change notification settings - Fork 21
Acceptable model
Anton Komarev edited this page Mar 24, 2020
·
5 revisions
<?php
namespace App\Models;
use Cog\Flag\Traits\Classic\HasAcceptedFlag;
use Illuminate\Database\Eloquent\Model;
class Post extends Model
{
use HasAcceptedFlag;
}
Model must have boolean is_accepted
column in database table.
<?php
namespace App\Models;
use Cog\Flag\Traits\Classic\HasAcceptedAt;
use Illuminate\Database\Eloquent\Model;
class Post extends Model
{
use HasAcceptedAt;
}
Model must have nullable timestamp accepted_at
column in database table.
Post::all();
Post::withNotAccepted()->get();
Post::withoutNotAccepted()->get();
Post::onlyNotAccepted()->get();
Post::whereKey(4)->accept();
Post::whereKey(4)->undoAccept();