public function modelNotFoundException(ModelNotFoundException $exception)
    {
        $entity = $this->extractEntityName($exception->getModel());

        $ids = implode($exception->getIds(), ',');

        $error = [[
            'status'    => 404,
            'code'      => $this->getCode('model_not_found'),
            'source'    => ['pointer' => 'data/id'],
            'title'     => $exception->getMessage(),
            'detail'    => __('exception::exceptions.model_not_found.title', ['model' => $entity]),
        ]];

        $this->jsonApiResponse->setStatus(404);
        $this->jsonApiResponse->setErrors($error);
    }
public function modelNotFoundException(ModelNotFoundException $exception)
    {
        $entity = $this->extractEntityName($exception->getModel());

        $ids = implode($exception->getIds(), ',');

        $error = [[
            'status'    => 404,
            'code'      => $this->getCode('model_not_found'),
            'source'    => ['pointer' => 'data/id'],
            'title'     => $exception->getMessage(),
            'detail'    => __('exception::exceptions.model_not_found.title', ['model' => $entity]),
        ]];

        $this->jsonApiResponse->setStatus(404);
        $this->jsonApiResponse->setErrors($error);
    }
public function modelNotFoundException ( ModelNotFoundException $ exception ) { $ entity = $ this -> extractEntityName ( $ exception -> getModel ( ) ) ; $ ids = implode ( $ exception -> getIds ( ) , ',' ) ; $ error = [ [ 'status' => 404 , 'code' => $ this -> getCode ( 'model_not_found' ) , 'source' => [ 'pointer' => 'data/id' ] , 'title' => $ exception -> getMessage ( ) , 'detail' => __ ( 'exception::exceptions.model_not_found.title' , [ 'model' => $ entity ] ) , ] ] ; $ this -> jsonApiResponse -> setStatus ( 404 ) ; $ this -> jsonApiResponse -> setErrors ( $ error ) ; }
Set the response if Exception is ModelNotFound.

@param  ModelNotFoundException $exception
Set the response if Exception is ModelNotFound .