错误!尚未应用特征方法恢复,因为App \ User-laravel softdelete上存在与其他特征方法的冲突

时间:2017-03-07 11:31:24

标签: laravel-5 traits soft-delete

使用softdelete后出现此错误,如何修复softdelete与其他特征..

class User extends Authenticatable
{
    use HasApiTokens, Notifiable;
    use EntrustUserTrait {
        can as traitCan;
        hasRole as traitHasRole;
    }
    use SoftDeletes;
    protected $table = 'users';

2 个答案:

答案 0 :(得分:3)

最后我找到了答案:

我决定使用softdelete restore。

use HasApiTokens, Notifiable;
    use EntrustUserTrait {
        can as traitCan;
        hasRole as traitHasRole;
    }
use SoftDeletes { SoftDeletes::restore insteadof EntrustUserTrait; }

或者如果你想同时使用两者:

use SoftDeletes,EntrustUserTrait{
        SoftDeletes::restore as soft_delete_restore;
        EntrustUserTrait::restore as entrust_restore;
    }

答案 1 :(得分:1)

添加此代码即可使用:

  20924 | {
  20925 |   ReactCurrentOwner.current = workInProgress;
  20926 |   ReactDebugCurrentFiber.setCurrentPhase('render');
> 20927 |   newChildren = render(newValue);
        |                 ^  20928 |           ReactDebugCurrentFiber.setCurrentPhase(null);
  20929 | } // React DevTools reads this flag.
  20930 |