protected function respond($event, $error, $status, $payload = [])
    {
        $response = $this->events->fire($event, $payload, true);

        $jsonApiError = new JsonApiError(str_replace('_', ' ', $error));
        $jsonApiError->setStatusCode($status);

        return $response ?: $this->response->json(['errors' => [$jsonApiError]], $status);
    }
protected function respond($event, $error, $status, $payload = [])
    {
        $response = $this->events->fire($event, $payload, true);

        $jsonApiError = new JsonApiError(str_replace('_', ' ', $error));
        $jsonApiError->setStatusCode($status);

        return $response ?: $this->response->json(['errors' => [$jsonApiError]], $status);
    }
protected function respond ( $ event , $ error , $ status , $ payload = [ ] ) { $ response = $ this -> events -> fire ( $ event , $ payload , true ) ; $ jsonApiError = new JsonApiError ( str_replace ( '_' , ' ' , $ error ) ) ; $ jsonApiError -> setStatusCode ( $ status ) ; return $ response ? : $ this -> response -> json ( [ 'errors' => [ $ jsonApiError ] ] , $ status ) ; }
Fire event and return the response.

@param  string $event
@param  string $error
@param  int $status
@param  array $payload
@return mixed
Fire event and return the response .