Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CircuitFactory:
- class CircuitFactory extends Factory
- {
- /**
- * Define the model's default state.
- *
- * @return array
- */
- public function definition(): array
- {
- return [
- 'name' => $this->faker->city(),
- 'country' => $this->faker->countryCode(),
- 'user_id' => User::factory()->create()->id,
- ];
- }
- }
- DriverFactory:
- class DriverFactory extends Factory
- {
- /**
- * Define the model's default state.
- *
- * @return array
- */
- public function definition(): array
- {
- return [
- 'universe_id' => Universe::factory()->create(),
- 'first_name' => $this->faker->firstName(),
- 'last_name' => $this->faker->lastName(),
- 'dob' => $this->faker->date(),
- 'country' => $this->faker->countryCode(),
- ];
- }
- }
- EngineFactory:
- class EngineFactory extends Factory
- {
- /**
- * Define the model's default state.
- *
- * @return array
- */
- public function definition(): array
- {
- return [
- 'series_id' => Series::factory()->create()->id,
- 'name' => $this->faker->name(),
- ];
- }
- }
- ```
- EntrantFactory:
- class EntrantFactory extends Factory
- {
- /**
- * Define the model's default state.
- *
- * @return array
- */
- public function definition(): array
- {
- $team = Team::factory()->create();
- return [
- 'season_id' => Season::factory()->create(),
- 'team_id' => $team->id,
- 'engine_id' => Engine::factory()->create(),
- 'full_name' => $team->full_name,
- 'short_name' => $team->short_name,
- 'team_principal' => $team->team_principal,
- 'primary_colour' => $team->primary_colour,
- 'secondary_colour' => $team->secondary_colour,
- 'country' => $team->country,
- 'active' => true,
- 'rating' => $this->faker->numberBetween(20, 40),
- 'reliability' => $this->faker->numberBetween(0, 11),
- ];
- }
- }
- RaceFactory:
- class RaceFactory extends Factory
- {
- /**
- * Define the model's default state.
- *
- * @return array
- */
- public function definition(): array
- {
- $series = Series::first() ?? Series::factory()->create();
- $season = $series->seasons()->first() ?? Season::factory()->for($series)->create();
- $user = $series->user;
- return [
- 'season_id' => $season,
- 'circuit_id' => Circuit::factory()->for($user)->create(),
- 'name' => "$season->year {$this->faker->country()} Grand Prix",
- 'stints' => [['min_rng' => 0, 'max_rng' => 30]],
- 'order' => 1,
- 'completed' => false,
- ];
- }
- }
- SeasonFactory:
- class SeasonFactory extends Factory
- {
- /**
- * Define the model's default state.
- *
- * @return array
- */
- public function definition(): array
- {
- return [
- 'series_id' => Series::factory()->create(),
- 'year' => $this->faker->year(2021),
- ];
- }
- }
- SeriesFactory:
- class SeriesFactory extends Factory
- {
- /**
- * Define the model's default state.
- *
- * @return array
- */
- public function definition(): array
- {
- return [
- 'universe_id' => Universe::factory()->create()->id,
- 'name' => $this->faker->name(),
- ];
- }
- }
- TeamFactory:
- class TeamFactory extends Factory
- {
- public function definition(): array
- {
- return [
- 'universe_id' => Universe::factory()->create(),
- 'full_name' => $this->faker->userName(),
- 'short_name' => $this->faker->firstName(),
- 'team_principal' => $this->faker->name(),
- 'primary_colour' => $this->faker->hexColor(),
- 'secondary_colour' => $this->faker->hexColor(),
- 'country' => $this->faker->countryCode(),
- ];
- }
- }
- UniverseFactory:
- class TeamFactory extends Factory
- {
- public function definition(): array
- {
- return [
- 'universe_id' => Universe::factory()->create(),
- 'full_name' => $this->faker->userName(),
- 'short_name' => $this->faker->firstName(),
- 'team_principal' => $this->faker->name(),
- 'primary_colour' => $this->faker->hexColor(),
- 'secondary_colour' => $this->faker->hexColor(),
- 'country' => $this->faker->countryCode(),
- ];
- }
- }
- UserFactory:
- class UserFactory extends Factory
- {
- /**
- * Define the model's default state.
- *
- * @return array
- */
- public function definition(): array
- {
- return [
- 'discord_id' => $this->faker->randomNumber(9),
- 'username' => $this->faker->userName(),
- 'avatar' => $this->faker->image(),
- 'is_admin' => false,
- ];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement