Read photoMarhun in CartController

This commit is contained in:
Amir
2022-12-01 09:49:50 +08:00
parent 9050816d6f
commit 92d2460a95
5 changed files with 52 additions and 0 deletions
+19
View File
@@ -92,4 +92,23 @@ class MarhunPhotoService
header('Content-Disposition: inline; filename="'.basename($filePath).'"');
readfile($filePath);
}
public function get($norujukan_sag, $marhun)
{
$lelongbidmarhun_id = $marhun->lelongbidmarhun_id;
$photo_type_name = $marhun->photo_type === 1 ? 'overall_photo' : 'by_marhun_photo';
$directory = "/{$norujukan_sag}/{$photo_type_name}/";
$imageExtension = $marhun->file_type;
$marhunImageFileName = "overall.{$imageExtension}";
if (!empty($lelongbidmarhun_id)) {
$marhunImageFileName = "$lelongbidmarhun_id.$imageExtension";
}
return Storage::disk('marhun')->get("{$directory}${marhunImageFileName}");
}
}