Skip to content

Conversation

@mmagdiel
Copy link
Contributor

@mmagdiel mmagdiel commented Jun 3, 2025

What kind of change does this PR introduce? (pls check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe below

Description

I was trying to run this migration but I couldn't.
type: '@faker.randomElements:bank,cash'

After drawing the application, he discovered that the error was in this line of code. The argument was sent to the function, but the case of that argument being a array was not considered, so it was passed as a string and subsequently failed to execute the Faker library.

$localFakerInstance = $localFakerInstance->{$fakerMethod[0]}($fakerMethod[1]);

The solution is to evaluate whether the condition is an array and format it so that the function actually runs in the generator.

                                if (strpos($fakerMethod[1], ',') !== false) {
                                    $arr = explode(",",$fakerMethod[1]);
                                    $localFakerInstance = $localFakerInstance->{$fakerMethod[0]}($arr);

If it is not an arrangement, the previous condition is executed and the regular flow of the application continues.

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

Related Issue

Sorry, something went wrong.

@mychidarko mychidarko merged commit eb89128 into leafsphp:v4.x Jul 17, 2025
@mychidarko
Copy link
Member

Thanks for the fix

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