src/Components/Recorder.php
public function record(Exception $e)
    {
        if ($this->shouldntHandle($e)) {
            return false;
        }

        $opts = [
            'class'       => get_class($e),
            'file'        => $e->getFile(),
            'line'        => $e->getLine(),
            'code'        => (is_int($e->getCode()) ? $e->getCode() : 0),
            'message'     => $e->getMessage(),
            'trace'       => $e->getTraceAsString(),
        ];

        $configDependant = array_keys($this->config['collect']);

        foreach ($configDependant as $key) {
            if ($this->canCollect($key)) {
                $value = $this->collect($key, $e);
                if ($value !== null) {
                    $opts[$key] = $value;
                }
            }
        }

        $class = config('lern.recorder.model');
        $class = !empty($class) ? $class : ExceptionModel::class;

        $model = new $class();
        foreach($opts as $key => $value) {
            $model->{$key} = $value;
        }

        $model->save();

        Cache::forever($this->getCacheKey($e), Carbon::now());

        return $model;
    }
public function record(Exception $e)
    {
        if ($this->shouldntHandle($e)) {
            return false;
        }

        $opts = [
            'class'       => get_class($e),
            'file'        => $e->getFile(),
            'line'        => $e->getLine(),
            'code'        => (is_int($e->getCode()) ? $e->getCode() : 0),
            'message'     => $e->getMessage(),
            'trace'       => $e->getTraceAsString(),
        ];

        $configDependant = array_keys($this->config['collect']);

        foreach ($configDependant as $key) {
            if ($this->canCollect($key)) {
                $value = $this->collect($key, $e);
                if ($value !== null) {
                    $opts[$key] = $value;
                }
            }
        }

        $class = config('lern.recorder.model');
        $class = !empty($class) ? $class : ExceptionModel::class;

        $model = new $class();
        foreach($opts as $key => $value) {
            $model->{$key} = $value;
        }

        $model->save();

        Cache::forever($this->getCacheKey($e), Carbon::now());

        return $model;
    }
public function record ( Exception $ e ) { if ( $ this -> shouldntHandle ( $ e ) ) { return false ; } $ opts = [ 'class' => get_class ( $ e ) , 'file' => $ e -> getFile ( ) , 'line' => $ e -> getLine ( ) , 'code' => ( is_int ( $ e -> getCode ( ) ) ? $ e -> getCode ( ) : 0 ) , 'message' => $ e -> getMessage ( ) , 'trace' => $ e -> getTraceAsString ( ) , ] ; $ configDependant = array_keys ( $ this -> config [ 'collect' ] ) ; foreach ( $ configDependant as $ key ) { if ( $ this -> canCollect ( $ key ) ) { $ value = $ this -> collect ( $ key , $ e ) ; if ( $ value !== null ) { $ opts [ $ key ] = $ value ; } } } $ class = config ( 'lern.recorder.model' ) ; $ class = ! empty ( $ class ) ? $ class : ExceptionModel :: class ; $ model = new $ class ( ) ; foreach ( $ opts as $ key => $ value ) { $ model -> { $ key } = $ value ; } $ model -> save ( ) ; Cache :: forever ( $ this -> getCacheKey ( $ e ) , Carbon :: now ( ) ) ; return $ model ; }
Records an Exception to the database
@param  Exception $e The exception you want to record
@return false|ExceptionModel
@throws RecorderFailedException
Records an Exception to the database