Compare commits

2 Commits
Author SHA1 Message Date
Althaf 16903b21e3 Merge branch 'main' of https://git.probindo.com/Probindo/database-pertani-web 2026-09-18 16:22:57 +07:00
Althaf 1d4a44b8ac update destroy 2026-09-18 16:22:48 +07:00
@@ -263,12 +263,28 @@ class PetaniController extends Controller
return redirect()->route('petani.edit', $petani->id)->with('success', 'Data petani berhasil diupdate.'); return redirect()->route('petani.edit', $petani->id)->with('success', 'Data petani berhasil diupdate.');
} }
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id) public function destroy(string $id)
{ {
// if (!Gate::any(['super_admin', 'admin', 'fasilitator'])) {
return response()->json(['message' => 'Anda tidak memiliki akses.'], 403);
}
try {
$petani = Petani::findOrFail($id);
$petani->delete();
return response()->json([
'status' => 'success',
'message' => 'Data petani berhasil dihapus.'
]);
} catch (\Exception $e) {
return response()->json([
'status' => 'error',
'message' => 'Gagal menghapus data: ' . $e->getMessage()
], 500);
}
} }
public function showImage(string $id, string $field) public function showImage(string $id, string $field)