laravel使用中我们可能需要对User model使用softdelete这个功能,以便删除后还可以恢复,不幸的是entrust模块也有这个方法,两者产生冲突,

解决办法:

https://laravel-china.org/topics/1775

class User extends Model implements AuthenticatableInterface
{
    use Authenticatable;
    use EntrustUserTrait { restore as private restoreA; }
    use SoftDeletes { restore as private restoreB; }

    /**
     * 解决 EntrustUserTrait 和 SoftDeletes 冲突
     */
    public function restore()
    {
        $this->restoreA();
        $this->restoreB();
    }
}

 

相关文章:

  • 2021-06-12
  • 2021-09-02
  • 2022-12-23
  • 2022-02-11
  • 2021-11-23
  • 2022-01-12
  • 2021-04-20
猜你喜欢
  • 2021-07-17
  • 2019-03-17
  • 2022-12-23
  • 2017-12-18
  • 2022-12-23
  • 2021-11-15
相关资源
相似解决方案