diff --git a/src/Events/StatusUpdated.php b/src/Events/StatusUpdated.php index e607e49..419fcfb 100644 --- a/src/Events/StatusUpdated.php +++ b/src/Events/StatusUpdated.php @@ -2,8 +2,8 @@ namespace Spatie\ModelStatus\Events; -use Illuminate\Database\Eloquent\Model; use Spatie\ModelStatus\Status; +use Illuminate\Database\Eloquent\Model; class StatusUpdated { diff --git a/src/HasStatuses.php b/src/HasStatuses.php index 3c9b7e4..e5b1621 100644 --- a/src/HasStatuses.php +++ b/src/HasStatuses.php @@ -2,16 +2,15 @@ namespace Spatie\ModelStatus; -use Illuminate\Database\Eloquent\Builder; -use Illuminate\Database\Eloquent\Relations\MorphMany; -use Illuminate\Database\Query\Builder as QueryBuilder; use Illuminate\Support\Facades\DB; +use Illuminate\Database\Eloquent\Builder; use Spatie\ModelStatus\Events\StatusUpdated; use Spatie\ModelStatus\Exceptions\InvalidStatus; +use Illuminate\Database\Eloquent\Relations\MorphMany; +use Illuminate\Database\Query\Builder as QueryBuilder; trait HasStatuses { - public function statuses(): MorphMany { return $this->morphMany($this->getStatusModelClassName(), 'model')->latest(); @@ -24,7 +23,7 @@ public function status(): ?Status public function setStatus(string $name, string $reason = ''): self { - if (!$this->isValidStatus($name, $reason)) { + if (! $this->isValidStatus($name, $reason)) { throw InvalidStatus::create($name); } @@ -97,7 +96,7 @@ function (QueryBuilder $query) use ($names) { public function getStatusAttribute(): string { - return (string)$this->latestStatus(); + return (string) $this->latestStatus(); } public function forceSetStatus(string $name, string $reason = ''): self diff --git a/tests/Events/StatusEventsTest.php b/tests/Events/StatusEventsTest.php index e97520f..5401c3a 100644 --- a/tests/Events/StatusEventsTest.php +++ b/tests/Events/StatusEventsTest.php @@ -3,11 +3,11 @@ namespace Spatie\ModelStatus\Tests\Events; use Illuminate\Support\Facades\Event; +use Spatie\ModelStatus\Tests\TestCase; use Spatie\ModelStatus\Events\StatusUpdated; use Spatie\ModelStatus\Tests\Models\TestModel; -use Spatie\ModelStatus\Tests\TestCase; -class StatusUpdatedTest extends TestCase +class StatusEventsTest extends TestCase { /** @var \Spatie\ModelStatus\Tests\Models\TestModel */ protected $testModel;