permissionService = $permissionService; } /** * Display a listing of the resource. */ public function index() { if (request()->ajax()) { $model = Permission::query()->latest(); return DataTables::eloquent($model) ->addIndexColumn() ->setRowClass('tableRow') ->addColumn('action', 'user::permission.datatable.action') ->rawColumns(['action']) ->toJson(); } return view('user::permission.index', [ 'title' => 'Permission Lists', ]); } /** * Show the form for creating a new resource. */ public function create() { // } /** * Store a newly created resource in storage. */ public function store(Request $request) { // } /** * Display the specified resource. */ public function show(string $id) { // } /** * Show the form for editing the specified resource. */ public function edit(Permission $permission) { // } /** * Update the specified resource in storage. */ public function update(Request $request, Permission $permission) { // } /** * Remove the specified resource from storage. */ public function destroy($id) { $this->permissionService->deletePermission($id); flash()->success("Permission has been deleted."); return response()->json(['status' => 200, 'message' => 'Permission has been deleted!'], 200); } }