feat: add compressed photo upload for LV, unit support, and employees

This commit is contained in:
Ray1111-aa
2026-10-20 16:00:29 +07:00
parent cb284a7432
commit 7126648c1c
10 changed files with 929 additions and 15 deletions
+17
View File
@@ -46,11 +46,28 @@ class Vehicle extends Model
'parent_id' => 'integer',
];
protected $appends = [
'photo_url',
];
public function isLightVehicle(): bool
{
return $this->category === 'light_vehicle';
}
public function getPhotoUrlAttribute(): ?string
{
if (!$this->photo_path) {
return null;
}
if (str_starts_with($this->photo_path, 'http://') || str_starts_with($this->photo_path, 'https://')) {
return $this->photo_path;
}
return asset('storage/' . ltrim($this->photo_path, '/'));
}
public function isUnitSupport(): bool
{
return $this->category === 'unit_support';