45 lines
971 B
PHP
45 lines
971 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class Vehicle extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'brand',
|
|
'model',
|
|
'registration_number',
|
|
'user_id',
|
|
'year',
|
|
'purchase_date',
|
|
'oc_expiry_date',
|
|
'oil_change_km',
|
|
'insurance_provider',
|
|
'technical_inspection_date',
|
|
'mileage_km',
|
|
'status',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'purchase_date' => 'date',
|
|
'oc_expiry_date' => 'date',
|
|
'technical_inspection_date' => 'date',
|
|
'year' => 'integer',
|
|
'oil_change_km' => 'integer',
|
|
'mileage_km' => 'integer',
|
|
];
|
|
}
|
|
|
|
public function user(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
}
|