petani lahan tanaman edit
This commit is contained in:
@@ -141,7 +141,8 @@ class PetaniLahanController extends Controller
|
||||
$lahanCount = Lahan::where('petani_id', $petaniId)
|
||||
->count();
|
||||
$lahanUid = strtoupper(Str::random(10));
|
||||
|
||||
|
||||
$foto = null;
|
||||
if ($request->hasFile('foto')) {
|
||||
$foto = [];
|
||||
foreach ($request->file('foto') as $file) {
|
||||
@@ -188,6 +189,14 @@ class PetaniLahanController extends Controller
|
||||
Tanaman::insert($chunk->toArray());
|
||||
});
|
||||
|
||||
if ($request->ajax()) {
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'redirect' => route('petani.lahan-tanaman.index', $petaniId),
|
||||
'message' => 'Lahan berhasil ditambahkan.'
|
||||
]);
|
||||
}
|
||||
|
||||
return redirect()->route('petani.lahan-tanaman.index', $petaniId)->with('success', 'Lahan berhasil ditambahkan.');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user