spatie / laravel-activitylog

Log activity inside your Laravel app

Home Page:https://docs.spatie.be/laravel-activitylog

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

subject_returns_soft_deleted_models fails

beybol opened this issue · comments

Describe the bug
When subject_returns_soft_deleted_models flag in the configuration file is set to true and there are soft deleteted objects I get en error:
Call to undefined method Illuminate\Database\Eloquent\Builder::withTrashed()

To Reproduce
Set the falg
Delete the obect and try to fetch the logs

Expected behavior
To get soft deleted models

Versions (please complete the following information)

  • PHP: 8.1.3
  • Database: Mysql 8.0.28
  • Laravel: 9.42.2
  • Package: 4.7

Stack Trace
\vendor\laravel\framework\src\Illuminate\Support\Traits\ForwardsCalls.php : 71

 *

 * @throws \BadMethodCallException

 */

protected function forwardDecoratedCallTo($object, $method, $parameters)

{

    $result = $this->forwardCallTo($object, $method, $parameters);


    if ($result === $object) {

        return $this;

    }


    return $result;

}


/**

 * Throw a bad method call exception for the given method.

 *

 * @param  string  $method

 * @return void

 *

 * @throws \BadMethodCallException

 */

protected static function throwBadMethodCallException($method)

{

    throw new BadMethodCallException(sprintf(

        'Call to undefined method %s::%s()', static::class, $method

    ));

}

}