0

I want to share user_id to the Payment factory. I need it.

My DatabaseSeeder's run function's content:

\App\Models\User::factory()->count(10)->has(
    \App\Models\Client::factory()->count(30)->has(
        \App\Models\Payment::factory()->count(30)
    )
)->create();

How I can implement this?

Oybek Odilov
  • 185
  • 9
  • I think answer is there. https://stackoverflow.com/questions/32540845/adding-relations-to-laravel-factory-model – Ts8060 Jan 04 '22 at 03:31
  • @Ts8060, no that's not what I want. Here are two user_id columns, in Client and in Payment. I know, that I don't need user_id in Payment because I can check the owner of the parent (Client) model, but I want to know, how I can implement this. – Oybek Odilov Jan 04 '22 at 08:42
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Jan 10 '22 at 16:23

0 Answers0