39 lines
967 B
PHP
39 lines
967 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Models\Concerns\AppendOnlyInventoryRecord;
|
|
use App\Models\Concerns\BelongsToTenant;
|
|
use Carbon\CarbonInterface;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
/**
|
|
* @property int $id
|
|
* @property int $tenant_id
|
|
* @property int $purchase_order_id
|
|
* @property int $received_by
|
|
* @property CarbonInterface $received_on
|
|
* @property string $payload_hash
|
|
* @property array<string, mixed> $snapshot
|
|
*/
|
|
class GoodsReceipt extends Model
|
|
{
|
|
use AppendOnlyInventoryRecord, BelongsToTenant;
|
|
|
|
public $timestamps = false;
|
|
|
|
protected $guarded = ['id'];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return ['snapshot' => 'array', 'received_on' => 'date:Y-m-d', 'confirmed_at' => 'datetime'];
|
|
}
|
|
|
|
/** @return HasMany<GoodsReceiptItem, $this> */
|
|
public function items(): HasMany
|
|
{
|
|
return $this->hasMany(GoodsReceiptItem::class)->orderBy('id');
|
|
}
|
|
}
|