-
-
Notifications
You must be signed in to change notification settings - Fork 20
Publishable model
Anton Komarev edited this page Mar 19, 2019
·
4 revisions
<?php
namespace App\Models;
use Cog\Flag\Traits\Classic\HasPublishedFlag;
use Illuminate\Database\Eloquent\Model;
class Post extends Model
{
use HasPublishedFlag;
}Model must have boolean is_published column in database table.
<?php
namespace App\Models;
use Cog\Flag\Traits\Classic\HasPublishedAt;
use Illuminate\Database\Eloquent\Model;
class Post extends Model
{
use HasPublishedAt;
}Model must have nullable timestamp published_at column in database table.
Post::all();
Post::withNotPublished();Post::withoutNotPublished();Post::onlyNotPublished();Post::where('id', 4)->publish();Post::where('id', 4)->undoPublish();