31 lines
678 B
PHP
31 lines
678 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class InventoryItem extends Model
|
|
{
|
|
/** @use HasFactory<\Database\Factories\InventoryItemFactory> */
|
|
use HasFactory;
|
|
|
|
protected $guarded = [];
|
|
|
|
protected $casts = [
|
|
'meta_jsonb' => 'array',
|
|
'last_seen_at' => 'datetime',
|
|
];
|
|
|
|
public function tenant(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Tenant::class);
|
|
}
|
|
|
|
public function lastSeenRun(): BelongsTo
|
|
{
|
|
return $this->belongsTo(InventorySyncRun::class, 'last_seen_run_id');
|
|
}
|
|
}
|