for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Thinktomorrow\Chief\States\Archivable;
use Thinktomorrow\Chief\States\PageState;
trait Archivable
{
protected static function bootArchivable()
static::addGlobalScope(new ArchiveScope());
}
public function isArchived(): bool
return $this->state() === PageState::ARCHIVED;
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::ARCHIVED;
public function scopeArchived($query)
$query->withoutGlobalScope(ArchiveScope::class)->where('state', PageState::ARCHIVED);
public function scopeUnarchived($query)
$query->withoutGlobalScope(ArchiveScope::class)->where('state','<>', PageState::ARCHIVED);
public function scopeWithArchived($query)
$query->withoutGlobalScope(ArchiveScope::class);