public function fail($messages, int $status = 400, string $code = null, string $customMessage = '')
	{
		if (! is_array($messages))
		{
			$messages = ['error' => $messages];
		}

		$response = [
			'status'   => $status,
			'error'    => $code === null ? $status : $code,
			'messages' => $messages,
		];

		return $this->respond($response, $status, $customMessage);
	}
public function fail($messages, int $status = 400, string $code = null, string $customMessage = '')
	{
		if (! is_array($messages))
		{
			$messages = ['error' => $messages];
		}

		$response = [
			'status'   => $status,
			'error'    => $code === null ? $status : $code,
			'messages' => $messages,
		];

		return $this->respond($response, $status, $customMessage);
	}
public function fail ( $ messages , int $ status = 400 , string $ code = null , string $ customMessage = '' ) { if ( ! is_array ( $ messages ) ) { $ messages = [ 'error' => $ messages ] ; } $ response = [ 'status' => $ status , 'error' => $ code === null ? $ status : $ code , 'messages' => $ messages , ] ; return $ this -> respond ( $ response , $ status , $ customMessage ) ; }
Used for generic failures that no custom methods exist for.

@param string|array $messages
@param integer|null $status        HTTP status code
@param string|null  $code          Custom, API-specific, error code
@param string       $customMessage

@return mixed
Used for generic failures that no custom methods exist for .