public function post(Request $request)
    {
        $this->authorizeUserAction('create');

        $model = new static::$model;

        $this->restfulService->validateResource($model, $request->input());

        $resource = $this->restfulService->persistResource(new $model($request->input()));

        // Retrieve full model
        $resource = $model::with($model::$localWith)->where($model->getKeyName(), '=', $resource->getKey())->first();

        if ($this->shouldTransform()) {
            $response = $this->response->item($resource, $this->getTransformer())->setStatusCode(201);
        } else {
            $response = $resource;
        }

        return $response;
    }
public function post(Request $request)
    {
        $this->authorizeUserAction('create');

        $model = new static::$model;

        $this->restfulService->validateResource($model, $request->input());

        $resource = $this->restfulService->persistResource(new $model($request->input()));

        // Retrieve full model
        $resource = $model::with($model::$localWith)->where($model->getKeyName(), '=', $resource->getKey())->first();

        if ($this->shouldTransform()) {
            $response = $this->response->item($resource, $this->getTransformer())->setStatusCode(201);
        } else {
            $response = $resource;
        }

        return $response;
    }
public function post ( Request $ request ) { $ this -> authorizeUserAction ( 'create' ) ; $ model = new static :: $ model ; $ this -> restfulService -> validateResource ( $ model , $ request -> input ( ) ) ; $ resource = $ this -> restfulService -> persistResource ( new $ model ( $ request -> input ( ) ) ) ; // Retrieve full model $ resource = $ model :: with ( $ model :: $ localWith ) -> where ( $ model -> getKeyName ( ) , '=' , $ resource -> getKey ( ) ) -> first ( ) ; if ( $ this -> shouldTransform ( ) ) { $ response = $ this -> response -> item ( $ resource , $ this -> getTransformer ( ) ) -> setStatusCode ( 201 ) ; } else { $ response = $ resource ; } return $ response ; }
Request to create a new resource

@param Request $request
@return \Dingo\Api\Http\Response
@throws HttpException|QueryException
Request to create a new resource