Mpociot\Reanimate\ReanimateModels::getUndoModel PHP Method

getUndoModel() private method

If that class also doesn't exist it throws a ClassNotFoundException
private getUndoModel ( ) : Eloquent
return Eloquent
    private function getUndoModel()
    {
        if (isset($this->undoDeleteModel)) {
            return new $this->undoDeleteModel();
        } else {
            // Try to guess the model name
            $self = new \ReflectionClass($this);
            $replacedClass = strrev(preg_replace(strrev("/Controller/"), "", strrev($self->getShortName()), 1));
            $modelClass = str_singular($replacedClass);
            if (class_exists($modelClass)) {
                return new $modelClass();
            } else {
                throw new ClassNotFoundException("The model class could not be generated. Please define the 'undoDeleteModel' property in your Controller.", new \ErrorException());
            }
        }
    }