2017-09-03 13 views

답변

0

봐.

/** 
* Boot the user model 
* Attach event listener to remove the many-to-many records when trying to delete 
* Will NOT delete any records if the user model uses soft deletes. 
* 
* @return void|bool 
*/ 
public static function boot() 
{ 
    parent::boot(); 
    static::deleting(function($user) { 
     if (!method_exists(Config::get('auth.model'), 'bootSoftDeletes')) { 
      $user->roles()->sync([]); 
     } 
     return true; 
    }); 
} 

난 당신이하지 bootSoftDeletes이 경우 Laravel 자신의 SoftDeletes의 특성을 사용하지 않는 것 같아요.

class User extends Authenticatable 
{ 
    use SoftDeletes; 
    use EntrustUserTrait; 
    ...