feat: [vehicle] 법인차량 사진 API 추가
- CorporateVehicle 모델 (photos 관계 포함) - VehiclePhotoService (R2 저장, 최대 10장 제한) - VehiclePhotoController (index/store/destroy) - StoreVehiclePhotoRequest (동적 max 검증) - finance.php 라우트 등록
This commit is contained in:
40
app/Models/Finance/CorporateVehicle.php
Normal file
40
app/Models/Finance/CorporateVehicle.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Finance;
|
||||
|
||||
use App\Models\Commons\File;
|
||||
use App\Traits\BelongsToTenant;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class CorporateVehicle extends Model
|
||||
{
|
||||
use BelongsToTenant, SoftDeletes;
|
||||
|
||||
protected $table = 'corporate_vehicles';
|
||||
|
||||
protected $fillable = [
|
||||
'tenant_id',
|
||||
'plate_number',
|
||||
'model',
|
||||
'vehicle_type',
|
||||
'ownership_type',
|
||||
'mileage',
|
||||
'options',
|
||||
'is_active',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'mileage' => 'integer',
|
||||
'options' => 'array',
|
||||
'is_active' => 'boolean',
|
||||
];
|
||||
|
||||
public function photos(): HasMany
|
||||
{
|
||||
return $this->hasMany(File::class, 'document_id')
|
||||
->where('document_type', 'corporate_vehicle')
|
||||
->orderBy('id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user