adrema/app/Nami/HasNamiField.php

17 lines
263 B
PHP
Raw Normal View History

2021-08-22 19:31:20 +02:00
<?php
namespace App\Nami;
trait HasNamiField
{
2023-02-05 23:35:08 +01:00
public static function nami(int $id): ?self
2021-08-22 19:31:20 +02:00
{
2023-02-05 23:35:08 +01:00
return static::firstWhere('nami_id', $id);
}
2021-08-22 19:31:20 +02:00
2023-02-05 23:35:08 +01:00
public function getHasNamiAttribute(): bool
{
return null !== $this->nami_id;
2021-08-22 19:31:20 +02:00
}
}