Skip to content

Commit

Permalink
perbaiki jika gambar kosong
Browse files Browse the repository at this point in the history
  • Loading branch information
apidong committed Jul 1, 2023
1 parent 61d1e0f commit 410896a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/Http/Controllers/Informasi/PotensiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,10 @@ public function update(PotensiRequest $request, Potensi $potensi)
$fileName = $lampiran->getClientOriginalName();
$path = "storage/potensi_kecamatan/";
$lampiran->move($path, $fileName);
unlink(base_path('public/' . $potensi->file_gambar));

if ($potensi->file_gambar && file_exists(base_path('public/' . $potensi->file_gambar))) {
unlink(base_path('public/' . $potensi->file_gambar));
}

$input['file_gambar'] = $path . $fileName;
}
Expand Down

0 comments on commit 410896a

Please sign in to comment.