44 lines
817 B
PHP
44 lines
817 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Enums\MaterielType;
|
|
use EloquentFilter\Filterable;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Materiel extends Model
|
|
{
|
|
use Filterable, HasFactory;
|
|
|
|
protected $attributes = [
|
|
'unit' => '吨',
|
|
];
|
|
|
|
protected $casts = [
|
|
'type' => MaterielType::class,
|
|
];
|
|
|
|
protected $fillable = [
|
|
'name',
|
|
'type',
|
|
'year',
|
|
'quarter',
|
|
'lowest_price',
|
|
'highest_price',
|
|
'unit',
|
|
'created_by',
|
|
'updated_by',
|
|
];
|
|
|
|
public function createdBy()
|
|
{
|
|
return $this->belongsTo(AdminUser::class, 'created_by');
|
|
}
|
|
|
|
public function updatedBy()
|
|
{
|
|
return $this->belongsTo(AdminUser::class, 'updated_by');
|
|
}
|
|
}
|