integrate image cropper for avatar upload/delete option/retouch
This commit is contained in:
@@ -224,6 +224,13 @@ class PetaniController extends Controller
|
||||
|
||||
$validatedData = $this->validatePetani($request);
|
||||
|
||||
if ($request->input('hapus_foto') == '1') {
|
||||
if ($petani->foto && Storage::exists($petani->foto)) {
|
||||
Storage::delete($petani->foto);
|
||||
}
|
||||
$validatedData['foto'] = null;
|
||||
}
|
||||
|
||||
if ($request->hasFile('file_ktp')) {
|
||||
$file_ktp = $request->file('file_ktp');
|
||||
$validatedData['path_ktp'] = $file_ktp->store('petani/ktp');
|
||||
@@ -235,6 +242,10 @@ class PetaniController extends Controller
|
||||
$validatedData['file_kk'] = $file_kk->getClientOriginalName();
|
||||
}
|
||||
if ($request->hasFile('foto')) {
|
||||
|
||||
if ($petani->foto && Storage::exists($petani->foto)) {
|
||||
Storage::delete($petani->foto);
|
||||
}
|
||||
$file_foto = $request->file('foto');
|
||||
$validatedData['foto'] = $file_foto->store('petani/foto');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user