attributes['password'] = bcrypt($password); } } protected static function boot() { parent::boot(); static::deleting(function ($model) { if (method_exists($model, 'isForceDeleting') && ! $model->isForceDeleting()) { return; } $model->roles()->detach(); }); } }