-
Notifications
You must be signed in to change notification settings - Fork 80
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
Call to undefined method Closure::format() #81
Comments
I ran into this too. The problem lies in the fact that the way you're declaring the variable TestDummy uses to generate is not the data itself, but rather a quick means to tell TestDummy how it should generate the data. In order to manipulate each date directly, you need to use a closure. From the docs (example modified):
$factory('App\MyModel', function($faker, $overrides) {
$date = $faker->dateTimeBetween('-1 days','+1 months')->format('Y-m-d');
return [
'date' => $date
];
}); |
Note, the closure doesn't accept an |
Thanks for that @gbrock . This produces a date that's the same in all entries. |
There seems to be a bug in defining closures introduced recently, covered in this issue. You could load the last working version in your composer.json:
...which works for the time being (thanks @h-collector). |
I had the same problem and #86 helped out. |
'date' => $faker->dateTimeBetween('-1 days','+1 months')->format('Y-m-d')
throws
Call to undefined method Closure::format()
The text was updated successfully, but these errors were encountered: