public function toArray()
    {
        $errorInfo['code'] = $this->getCode();
        $errorInfo['context'] = $this->getContext();
        $errorInfo['message'] = htmlentities($this->getMessage());

        if (config('app.debug', false)) {
            $trace = $this->getTraceAsString();
            $trace = str_replace(["\n", "#"], ["", "<br>"], $trace);
            $traceArray = explode("<br>", $trace);
            $cleanTrace = [];
            foreach ($traceArray as $k => $v) {
                if (!empty($v)) {
                    $cleanTrace[] = $v;
                }
            }
            $errorInfo['trace'] = $cleanTrace;
        }

        return $errorInfo;
    }
public function toArray()
    {
        $errorInfo['code'] = $this->getCode();
        $errorInfo['context'] = $this->getContext();
        $errorInfo['message'] = htmlentities($this->getMessage());

        if (config('app.debug', false)) {
            $trace = $this->getTraceAsString();
            $trace = str_replace(["\n", "#"], ["", "<br>"], $trace);
            $traceArray = explode("<br>", $trace);
            $cleanTrace = [];
            foreach ($traceArray as $k => $v) {
                if (!empty($v)) {
                    $cleanTrace[] = $v;
                }
            }
            $errorInfo['trace'] = $cleanTrace;
        }

        return $errorInfo;
    }
public function toArray ( ) { $ errorInfo [ 'code' ] = $ this -> getCode ( ) ; $ errorInfo [ 'context' ] = $ this -> getContext ( ) ; $ errorInfo [ 'message' ] = htmlentities ( $ this -> getMessage ( ) ) ; if ( config ( 'app.debug' , false ) ) { $ trace = $ this -> getTraceAsString ( ) ; $ trace = str_replace ( [ "\n" , "#" ] , [ "" , "<br>" ] , $ trace ) ; $ traceArray = explode ( "<br>" , $ trace ) ; $ cleanTrace = [ ] ; foreach ( $ traceArray as $ k => $ v ) { if ( ! empty ( $ v ) ) { $ cleanTrace [ ] = $ v ; } } $ errorInfo [ 'trace' ] = $ cleanTrace ; } return $ errorInfo ; }
Convert this exception to array output

@return array
Convert this exception to array output