photos; } public function store(int $equipmentId, array $fileData): File { $equipment = Equipment::find($equipmentId); if (! $equipment) { throw new NotFoundHttpException(__('error.equipment.not_found')); } return File::create(array_merge($fileData, [ 'document_id' => $equipmentId, 'document_type' => 'equipment', ])); } public function destroy(int $equipmentId, int $fileId): bool { $file = File::where('document_id', $equipmentId) ->where('document_type', 'equipment') ->where('id', $fileId) ->first(); if (! $file) { throw new NotFoundHttpException(__('error.file.not_found')); } return $file->delete(); } }