40 lines
950 B
PHP
40 lines
950 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Models\Concerns\BelongsToTenant;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
/** @property array<string, mixed> $weights */
|
|
class Quotation extends Model
|
|
{
|
|
use BelongsToTenant;
|
|
|
|
protected $guarded = ['id'];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return ['weights' => 'array', 'valid_until' => 'date:Y-m-d'];
|
|
}
|
|
|
|
/** @return BelongsTo<Supplier, $this> */
|
|
public function supplier(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Supplier::class);
|
|
}
|
|
|
|
/** @return HasMany<QuotationItem, $this> */
|
|
public function items(): HasMany
|
|
{
|
|
return $this->hasMany(QuotationItem::class);
|
|
}
|
|
|
|
/** @return HasMany<ProposalEvaluation, $this> */
|
|
public function evaluations(): HasMany
|
|
{
|
|
return $this->hasMany(ProposalEvaluation::class);
|
|
}
|
|
}
|