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(); } }