*/ final class SurveyFactory extends Factory { /** * The name of the factory's corresponding model. * * @var string */ protected $model = Survey::class; /** * Define the model's default state. * * @return array */ public function definition(): array { $is = fake()->boolean; return [ 'user_id' => fake()->randomElement(User::pluck('id')), 'name' => fake()->word, 'author' => fake()->word, 'comment' => fake()->word, 'date' => fake()->dateTime(), 'documents' => [fake()->word], 'is_distributor' => ($is) ? 1 : 0, 'is_customer' => (!$is) ? 1 : 0, 'deleted_at' => fake()->dateTime(), ]; } }