*/ class UserDishFactory extends Factory { public function definition(): array { return [ 'dish_id' => null, 'user_id' => null, ]; } public function dish(Dish $dish): self { return $this->state(fn (array $attributes) => [ 'dish_id' => $dish->id, ]); } public function user(User $user): self { return $this->state(fn (array $attributes) => [ 'user_id' => $user->id, ]); } }