Fix saving marhun photo file to correct directory

This commit is contained in:
afiq.hamzah
2022-11-27 15:15:44 +08:00
parent 2c6b80c345
commit 157597ab46
2 changed files with 5 additions and 7 deletions
+4 -6
View File
@@ -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}";
+1 -1
View File
@@ -66,7 +66,7 @@
<div class="card-body" style="align-self: center; justify-content: center;">
@if ($lelongbid['filemarhun_filename'] != null)
<button type="button" data-toggle="modal" onclick="kesulurahanMarhunData(this)" data-lelongid="{{$lelongbid['lelong_id']}}" data-lelongbidid="{{$lelongbid['id']}}" data-fileid="{{ $lelongbid['filemarhun_id'] }}" data-target="#modaloverallphoto">
<img src="{{ route('marhun.showphotomarhun', ['lelong_id' => $lelongbid['lelong_id'], 'filemarhun_id' => $lelongbid['filemarhun_id']]) }}" width="100%">
<img src="{{ route('marhun.showphotomarhun', ['norujukan_sag' => $lelongbid['norujukan_sag'], 'filemarhun_id' => $lelongbid['filemarhun_id']]) }}" width="100%">
</button>
@else
<p>Tiada Data</p>