Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Sithu's avatar
Level 14

fzaninotto/Faker date function gives error

Hi Everyone

When I try to seed birth_date with Faker date function gives error like that

  [InvalidArgumentException]
  The separation symbol could not be found
  Trailing data

My seeding code is

User::create([
     'birth_date' => $faker->date($format = 'Y-m-d', $max = '-35 years'),
]);

Faker date function works fine with test route. But within seeding code rise error.

Can someone help me?

0 likes
1 reply
DavidGaillard's avatar

I had the exact same issue. It was because the field I was trying to populate using faker had a mutator in my model. Therefore I had to make sure that faker produce exactly what my mutator expected.

1 like

Please or to participate in this conversation.