diff --git a/app/Http/Controllers/MarhunController.php b/app/Http/Controllers/MarhunController.php index 17946569..aca2ed33 100644 --- a/app/Http/Controllers/MarhunController.php +++ b/app/Http/Controllers/MarhunController.php @@ -517,6 +517,7 @@ class MarhunController extends Controller { $lelongbid = LelongBid::where('id', '=', $id)->first(); + $norujukan_sag = $lelongbid->norujukan; $filemarhun = FileMarhun::where('lelongbid_id', '=', $lelongbid['id']) ->where('photo_type', '=', '1') ->first(); @@ -537,7 +538,7 @@ class MarhunController extends Controller foreach ($marhun as $index) { $eachmarhun = FileMarhun::where('lelongbidmarhun_id', '=', $index['id'])->first(); if (isset($eachmarhun)) { - $index->eachmarhun_filename = route('marhun.showphotomarhun', ['lelong_id' => $lelong_id, 'filemarhun_id' => $eachmarhun]); + $index->eachmarhun_filename = route('marhun.showphotomarhun', ['norujukan_sag' => $norujukan_sag, 'filemarhun_id' => $eachmarhun]); $index->eachmarhun_id = $eachmarhun->id; } @@ -2258,7 +2259,7 @@ class MarhunController extends Controller public function showPhotoMarhun(Request $request) { $marhun = FileMarhun::where('id', '=', $request->filemarhun_id)->first(); - return $this->marhunPhotoService->show($request->lelong_id, $marhun); + return $this->marhunPhotoService->show($request->norujukan_sag, $marhun); } diff --git a/app/Services/MarhunPhotoService.php b/app/Services/MarhunPhotoService.php index 03a534be..08340e99 100644 --- a/app/Services/MarhunPhotoService.php +++ b/app/Services/MarhunPhotoService.php @@ -28,7 +28,7 @@ class MarhunPhotoService $addfile->save(); } - $no_rujukan_sag = LelongBid::select('norujukan')->where('lelong_id', $request->lelong_id)->first()->norujukan; + $no_rujukan_sag = LelongBid::select('norujukan')->where('id', $request->lelongbid_id)->first()->norujukan; $photo_type_name = $request->photo_type === '1' ? 'overall_photo' : 'by_marhun_photo'; $directory = "/{$no_rujukan_sag}/{$photo_type_name}/"; @@ -47,7 +47,7 @@ class MarhunPhotoService { $deleteFile = FileMarhun::where('id', '=', $request->filemarhun_id)->first(); - $no_rujukan_sag = LelongBid::select('norujukan')->where('lelong_id', $request->lelong_id)->first()->norujukan; + $no_rujukan_sag = LelongBid::select('norujukan')->where('id', $request->lelongbid_id)->first()->norujukan; $photo_type_name = $request->photo_type === '1' ? 'overall_photo' : 'by_marhun_photo'; $directory = "/{$no_rujukan_sag}/{$photo_type_name}/"; @@ -65,15 +65,13 @@ class MarhunPhotoService $deleteFile->delete(); } - public function show($lelong_id, $marhun) + public function show($norujukan_sag, $marhun) { $lelongbidmarhun_id = $marhun->lelongbidmarhun_id; - $lelong_id = $lelong_id; - $no_rujukan_sag = LelongBid::select('norujukan')->where('lelong_id', $lelong_id)->first()->norujukan; $photo_type_name = $marhun->photo_type === 1 ? 'overall_photo' : 'by_marhun_photo'; - $directory = "/{$no_rujukan_sag}/{$photo_type_name}/"; + $directory = "/{$norujukan_sag}/{$photo_type_name}/"; $imageExtension = $marhun->file_type; $marhunImageFileName = "overall.{$imageExtension}"; diff --git a/resources/views/marhun/marhun.blade.php b/resources/views/marhun/marhun.blade.php index 4b00aa60..626d5d56 100644 --- a/resources/views/marhun/marhun.blade.php +++ b/resources/views/marhun/marhun.blade.php @@ -66,7 +66,7 @@
Tiada Data
@@ -426,7 +426,7 @@ @else