permissionRepository = $permissionRepository; } /** * Display a listing of the resource. */ public function index() { $data['permissionLists'] = $this->permissionRepository->findAll(); $data['title'] = 'Permission Lists'; return view('user::permissions.index', $data); } /** * 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(Permission $permission) { $permission->delete(); toastr()->success('Permission has been deleted!'); return redirect()->back(); } public function generatePermissionFromRoutes() { try { $this->permissionRepository->generatePermissionFromRoutes(); toastr()->success('Permission generated successfully!'); } catch (\Throwable $th) { toastr()->error($th->getMessage()); } return to_route('permission.index'); } }