Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds define() method to ModelFactory #5897

Merged
merged 2 commits into from Jul 3, 2023
Merged

Conversation

huangdijia
Copy link
Member

@huangdijia huangdijia commented Jul 2, 2023

$this->modelFactory->define(User::class, function (Faker $faker) {
    return [
        'name' => $faker->name,
        'email' => $faker->unique()->safeEmail,
        'password' => md5('password123'),
    ];
});

$user = $this->modelFactory->factory(User::class)->create();

@limingxinleo limingxinleo merged commit 47a30da into hyperf:3.1 Jul 3, 2023
35 checks passed
@huangdijia huangdijia deleted the patch-1 branch July 3, 2023 04:42
@huangdijia huangdijia added this to the v3.1 milestone Jul 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants