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