コード例 #1
0
ファイル: RoleAware.php プロジェクト: ndrx-io/elude
 /**
  * @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);
 }