Merge branch 'main' of https://git.probindo.com/Probindo/database-pertani-web
This commit is contained in:
@@ -263,12 +263,10 @@ 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'])) {
|
if (!Gate::any(['super_admin', 'admin', 'fasilitator'])) {
|
||||||
|
<<<<<<< HEAD
|
||||||
abort(403);
|
abort(403);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -289,6 +287,27 @@ class PetaniController extends Controller
|
|||||||
return response()->json([
|
return response()->json([
|
||||||
'message' => 'Data petani berhasil dihapus.',
|
'message' => 'Data petani berhasil dihapus.',
|
||||||
]);
|
]);
|
||||||
|
=======
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
>>>>>>> 16903b21e36609a7257f376b49762e4b5070024f
|
||||||
}
|
}
|
||||||
|
|
||||||
public function showImage(string $id, string $field)
|
public function showImage(string $id, string $field)
|
||||||
|
|||||||
Reference in New Issue
Block a user