public function setUp() { $this->manager = $this->getManager(); parent::setUp(); $this->user = $this->userRepository->create(new \App\User(['username' => $this->faker->userName, 'email' => $this->faker->safeEmail, 'password' => $this->faker->password()])); $this->group = $this->groupRepository->create(new \App\Group(['name' => uniqid()])); $this->role = $this->roleRepository->create(new \App\Role(['name' => uniqid(), 'filter' => 'A'])); $this->roleRevoke = $this->roleRepository->create(new \App\Role(['name' => uniqid(), 'filter' => 'R'])); $this->permissionFirst = $this->permissionRepository->create(new \App\Permission(['area' => uniqid(), 'permission' => uniqid(), 'description' => 'test'])); $this->permissionSecond = $this->permissionRepository->create(new \App\Permission(['area' => uniqid(), 'permission' => uniqid(), 'description' => 'test'])); $this->initiate(); }
/** * @author LAHAXE Arnaud * * @param $id * @param $idRole * * @return \Symfony\Component\HttpFoundation\Response * * * @apiDefine deleteRole * @apiName destroyRole * @apiErrorExample {json} Error-Response: * HTTP/1.1 404 Not Found * {} * * @apiErrorExample {json} Error-Response: * HTTP/1.1 401 Not Authorized * {} * * @apiName show * @apiParam {Number} id Model unique ID. * @apiParam {Number} idRole Role unique ID. */ public function roleDestroy($id, $idRole) { $this->addUserCriteria(); $model = $this->repository->find($id); $role = $this->roleRepository->find($idRole); if (is_null($model) || is_null($role)) { return response()->json([], 404); } $this->repository->removeRole($model, $role); return response()->json($model, 202); }