56 lines
1.1 KiB
PHP
56 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Models\Registries;
|
|
|
|
use App\Models\Asset;
|
|
use App\Support\RelationValuesTrait;
|
|
use App\Support\UuidScopeTrait;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class Operation extends Model {
|
|
use UuidScopeTrait, SoftDeletes, RelationValuesTrait;
|
|
|
|
protected $table = 'registry_entry_operations';
|
|
|
|
protected $dates = [
|
|
'order_date',
|
|
'active_since',
|
|
'active_till',
|
|
];
|
|
|
|
protected $fillable = [
|
|
'uuid',
|
|
'entry_id',
|
|
'order_id',
|
|
'type',
|
|
'developer',
|
|
'order_name',
|
|
'order_date',
|
|
'active_since',
|
|
'active_till'
|
|
];
|
|
|
|
protected $hidden = [
|
|
'id'
|
|
];
|
|
|
|
|
|
public function entry(): BelongsTo {
|
|
return $this->belongsTo(Entry::class);
|
|
}
|
|
|
|
public function order(): BelongsTo {
|
|
return $this->belongsTo(Asset::class);
|
|
}
|
|
|
|
|
|
public function getParsedTypeAttribute(): array {
|
|
return ['name' => $this->type, 'title' => OperationType::TITLES[$this->type] ?? null];
|
|
}
|
|
|
|
|
|
|
|
}
|