Skip to content

[FactoryCollection] add a way to index by a specific field #897

Open
@nikophil

Description

@nikophil

something like this could be useful:

$users = UserFactory::new()
	 ->sequence([['username' => 'foo', 'username' => 'bar']])
	 ->indexBy('username')
	 ->create();

and then, we can access users by their username: $users['foo], $users['bar']`

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions