Есть такая заготовка:
public function run()
{
User::factory()
->count(2)
->sequence(fn ($sequence) => ['phone' => 70000000000 + $sequence->index, 'email' => "test{$sequence->index}@mail.ru"])
->has(
Project::factory()
->count(2)
->sequence(fn ($sequence) => ['name' => "Проект №{$sequence->index}"])
->has(
Menu::factory()
->count(2)
->sequence(fn ($sequence) => ['name' => "Меню №{$sequence->index}"])
->has(
Dishe::factory()
->count(2)
->sequence(fn ($sequence) => ['name' => "Блюдо №{$sequence->index}"])
)
->has(
Category::factory()
->count(2)
->sequence(fn ($sequence) => ['name' => "Категория №{$sequence->index}"])
)
->has(
Modifier::factory()
->count(2)
->sequence(fn ($sequence) => ['name' => "Модификатор №{$sequence->index}"])
)
)
->has(
Table::factory()
->count(2)
->sequence(fn ($sequence) => ['name' => "Стол №{$sequence->index}"])
)
->has(
Order::factory()
->count(2)
)
)
->create();
}
Как можно для
Order установить существующий
Table? (в таблице
orders есть поле
table_id)