V
V
Vavilov5732018-05-24 09:05:30
Laravel
Vavilov573, 2018-05-24 09:05:30

Faker - how to create a category tree?

How to populate category table with structure :
id, name, parent_id, created_at, updated_id ?
Just so that there would not be a situation when category 3 has a child category 5, category 5 has a child 6, and category 6 has a child 3

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Mashletov, 2018-05-24
@mashletov

Seeding databases with a factory & faker is not particularly suitable for cases where you need to take into account previous created records. It's easier to do it manually through a loop, as for me.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question