petani lahan hapus
This commit is contained in:
@@ -379,9 +379,23 @@ class PetaniLahanController extends Controller
|
||||
return redirect()->route('petani.lahan-tanaman.index', $petaniId)->with('success', 'Lahan berhasil diperbarui.');
|
||||
}
|
||||
|
||||
public function destroy(string $id)
|
||||
public function destroy(string $petaniId, string $id)
|
||||
{
|
||||
//
|
||||
if (!Gate::any(['super_admin', 'admin', 'fasilitator'])) {
|
||||
abort(403);
|
||||
}
|
||||
|
||||
$lahan = Lahan::findOrFail($id);
|
||||
$lahan->tanaman()->update([
|
||||
'deleted_by' => auth()->id()
|
||||
]);
|
||||
$lahan->tanaman()->delete();
|
||||
$lahan->update([
|
||||
'deleted_by' => auth()->id()
|
||||
]);
|
||||
$lahan->delete();
|
||||
|
||||
return redirect()->route('petani.lahan-tanaman.index', $petaniId)->with('success', 'Lahan berhasil dihapus.');
|
||||
}
|
||||
|
||||
public function summary(string $petaniId)
|
||||
|
||||
Reference in New Issue
Block a user