Files
nala 63d20b10fc
tests / ci (push) Canceled after 0s
commit de armazens
2026-11-04 09:40:26 +02:00

41 lines
1014 B
PHP

<?php
namespace App\Models;
use App\Models\Concerns\BelongsToTenant;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
/**
* @property array{country:string,catalogue:string,record_id:string}|null $geography_reference
* @property int $id
* @property int $tenant_id
* @property int $created_by
* @property int|null $last_changed_by
* @property int $version
*/
class Supplier extends Model
{
use BelongsToTenant;
protected $guarded = ['id'];
protected $attributes = ['version' => 1];
protected function casts(): array
{
return ['blocked' => 'boolean', 'next_review' => 'date:Y-m-d', 'geography_reference' => 'array'];
}
public function eligible(): bool
{
return $this->status === 'active' && ! $this->blocked && $this->next_review >= today();
}
/** @return HasMany<SupplierDocument, $this> */
public function documents(): HasMany
{
return $this->hasMany(SupplierDocument::class);
}
}