feat:차량정비이력 실제 DB 연동 구현
This commit is contained in:
55
app/Models/VehicleMaintenance.php
Normal file
55
app/Models/VehicleMaintenance.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class VehicleMaintenance extends Model
|
||||
{
|
||||
use HasFactory, SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'tenant_id',
|
||||
'vehicle_id',
|
||||
'date',
|
||||
'category',
|
||||
'description',
|
||||
'amount',
|
||||
'mileage',
|
||||
'vendor',
|
||||
'memo',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'date' => 'date',
|
||||
'amount' => 'integer',
|
||||
'mileage' => 'integer',
|
||||
];
|
||||
|
||||
/**
|
||||
* 차량 관계
|
||||
*/
|
||||
public function vehicle(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(CorporateVehicle::class, 'vehicle_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 테넌트 관계
|
||||
*/
|
||||
public function tenant(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Tenant::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 카테고리 목록
|
||||
*/
|
||||
public static function getCategories(): array
|
||||
{
|
||||
return ['주유', '정비', '보험', '세차', '주차', '통행료', '검사', '기타'];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user