belongsToMany( User::class, 'model_has_roles', 'role_id', 'model_id' )->wherePivot('model_type', User::class) ->withPivotValue('model_type', User::class); } }