count(4)->create(); $firstAdmin = User::factory()->administrator()->create([ 'name' => 'first', ]); $secondAdmin = User::factory()->administrator()->create([ 'name' => 'secondAdmin', ]); $admins = User::admins()->get(); $this->assertCount(2, $admins); $this->assertEquals($admins[0]->is_admin, true); $this->assertEquals($admins[1]->is_admin, true); $this->assertEquals($admins[0]->name, $firstAdmin->name); $this->assertEquals($admins[1]->name, $secondAdmin->name); } }