Laravel - Database - Many To Many Relationships

Like has many relationships, "many to many" relationships may be created using the has method:

    
    use App\Models\Role;
    use App\Models\User;
    
    $user = User::factory()
                ->has(Role::factory()->count(3))
                ->create();