for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Thinktomorrow\Chief\States\Publishable;
use Thinktomorrow\Chief\States\PageState;
trait Publishable
{
public function isPublished(): bool
return $this->state() === PageState::PUBLISHED;
state()
If this is a false-positive, you can also ignore this issue in your code via the ignore-call annotation
ignore-call
return $this->/** @scrutinizer ignore-call */ state() === PageState::PUBLISHED;
}
public function isDraft(): bool
return $this->state() === PageState::DRAFT;
public function scopePublished($query)
// Here we widen up the results in case of preview mode and ignore the published scope
if (PreviewMode::fromRequest()->check()) {
return;
$query->where('current_state', PageState::PUBLISHED);
public function scopeDrafted($query)
$query->where('current_state', PageState::DRAFT);
public static function getAllPublished()
return self::published()->get();