src/Gzero/Api/Controller/Admin/RouteController.php
public function store($contentId)
    {
        $content = $this->repository->getById($contentId);
        if (!empty($content)) {
            $this->authorize('create', $content);
            $this->authorize('update', $content);
            if ($content->type != 'category') {
                $input = $this->validator->validate('create');
                $route = $this->repository->createRoute($content, $input['lang_code'], $input['url']);
                return $this->respondWithSuccess($route, new RouteTransformer);
            } else {
                // TODO categories children route update
                throw new RepositoryValidationException("You can't change category url", 500);
            }
        }
        return $this->respondNotFound();
    }
public function store($contentId)
    {
        $content = $this->repository->getById($contentId);
        if (!empty($content)) {
            $this->authorize('create', $content);
            $this->authorize('update', $content);
            if ($content->type != 'category') {
                $input = $this->validator->validate('create');
                $route = $this->repository->createRoute($content, $input['lang_code'], $input['url']);
                return $this->respondWithSuccess($route, new RouteTransformer);
            } else {
                // TODO categories children route update
                throw new RepositoryValidationException("You can't change category url", 500);
            }
        }
        return $this->respondNotFound();
    }
public function store ( $ contentId ) { $ content = $ this -> repository -> getById ( $ contentId ) ; if ( ! empty ( $ content ) ) { $ this -> authorize ( 'create' , $ content ) ; $ this -> authorize ( 'update' , $ content ) ; if ( $ content -> type != 'category' ) { $ input = $ this -> validator -> validate ( 'create' ) ; $ route = $ this -> repository -> createRoute ( $ content , $ input [ 'lang_code' ] , $ input [ 'url' ] ) ; return $ this -> respondWithSuccess ( $ route , new RouteTransformer ) ; } else { // TODO categories children route update throw new RepositoryValidationException ( "You can't change category url" , 500 ) ; } } return $ this -> respondNotFound ( ) ; }
Stores newly created route for specified content entity in database.

@param int $contentId Id of the content

@return \Illuminate\Http\JsonResponse
@throws RepositoryValidationException
Stores newly created route for specified content entity in database .