/**
  * Remove the permission.
  *
  * @param int $id
  *
  * @return Response
  */
 public function destroy(PermissionAdminWebRequest $request, Permission $permission)
 {
     try {
         $t = $permission->delete();
         return response()->json(['message' => trans('messages.success.deleted', ['Module' => trans('user::permission.name')]), 'code' => 202, 'redirect' => trans_url('/admin/user/permission/0')], 202);
     } catch (Exception $e) {
         return response()->json(['message' => $e->getMessage(), 'code' => 400, 'redirect' => trans_url('/admin/user/permission/' . $permission->getRouteKey())], 400);
     }
 }
Exemplo n.º 2
0
 /**
  * Remove the specified resource.
  *
  * @param int $id
  *
  * @return Response
  */
 public function destroy(PermissionAdminRequest $request, Permission $permission)
 {
     try {
         $t = $permission->delete();
         $this->responseCode = 202;
         $this->responseMessage = trans('messages.success.deleted', ['Module' => 'Permission']);
         $this->responseRedirect = trans_url('/admin/user/permission/0');
         return $this->respond($request);
     } catch (Exception $e) {
         $this->responseCode = 400;
         $this->responseMessage = $e->getMessage();
         $this->responseRedirect = trans_url('/admin/user/permission/' . $permission->getRouteKey());
         return $this->respond($request);
     }
 }
 public function transform(\Litepie\User\Models\Permission $permission)
 {
     return ['id' => $permission->getRouteKey(), 'name' => $permission->name, 'slug' => $permission->slug];
 }