Advertisement
LilPecky

Untitled

Jan 7th, 2022
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.98 KB | None | 0 0
  1. CircuitFactory:
  2.  
  3. class CircuitFactory extends Factory
  4. {
  5. /**
  6. * Define the model's default state.
  7. *
  8. * @return array
  9. */
  10. public function definition(): array
  11. {
  12. return [
  13. 'name' => $this->faker->city(),
  14. 'country' => $this->faker->countryCode(),
  15. 'user_id' => User::factory()->create()->id,
  16. ];
  17. }
  18. }
  19.  
  20. DriverFactory:
  21.  
  22. class DriverFactory extends Factory
  23. {
  24. /**
  25. * Define the model's default state.
  26. *
  27. * @return array
  28. */
  29. public function definition(): array
  30. {
  31. return [
  32. 'universe_id' => Universe::factory()->create(),
  33. 'first_name' => $this->faker->firstName(),
  34. 'last_name' => $this->faker->lastName(),
  35. 'dob' => $this->faker->date(),
  36. 'country' => $this->faker->countryCode(),
  37. ];
  38. }
  39. }
  40.  
  41. EngineFactory:
  42.  
  43. class EngineFactory extends Factory
  44. {
  45. /**
  46. * Define the model's default state.
  47. *
  48. * @return array
  49. */
  50. public function definition(): array
  51. {
  52. return [
  53. 'series_id' => Series::factory()->create()->id,
  54. 'name' => $this->faker->name(),
  55. ];
  56. }
  57. }
  58. ```
  59.  
  60. EntrantFactory:
  61.  
  62. class EntrantFactory extends Factory
  63. {
  64. /**
  65. * Define the model's default state.
  66. *
  67. * @return array
  68. */
  69. public function definition(): array
  70. {
  71. $team = Team::factory()->create();
  72. return [
  73. 'season_id' => Season::factory()->create(),
  74. 'team_id' => $team->id,
  75. 'engine_id' => Engine::factory()->create(),
  76. 'full_name' => $team->full_name,
  77. 'short_name' => $team->short_name,
  78. 'team_principal' => $team->team_principal,
  79. 'primary_colour' => $team->primary_colour,
  80. 'secondary_colour' => $team->secondary_colour,
  81. 'country' => $team->country,
  82. 'active' => true,
  83. 'rating' => $this->faker->numberBetween(20, 40),
  84. 'reliability' => $this->faker->numberBetween(0, 11),
  85. ];
  86. }
  87. }
  88.  
  89.  
  90. RaceFactory:
  91.  
  92. class RaceFactory extends Factory
  93. {
  94. /**
  95. * Define the model's default state.
  96. *
  97. * @return array
  98. */
  99. public function definition(): array
  100. {
  101. $series = Series::first() ?? Series::factory()->create();
  102. $season = $series->seasons()->first() ?? Season::factory()->for($series)->create();
  103. $user = $series->user;
  104. return [
  105. 'season_id' => $season,
  106. 'circuit_id' => Circuit::factory()->for($user)->create(),
  107. 'name' => "$season->year {$this->faker->country()} Grand Prix",
  108. 'stints' => [['min_rng' => 0, 'max_rng' => 30]],
  109. 'order' => 1,
  110. 'completed' => false,
  111. ];
  112. }
  113. }
  114.  
  115. SeasonFactory:
  116.  
  117. class SeasonFactory extends Factory
  118. {
  119. /**
  120. * Define the model's default state.
  121. *
  122. * @return array
  123. */
  124. public function definition(): array
  125. {
  126. return [
  127. 'series_id' => Series::factory()->create(),
  128. 'year' => $this->faker->year(2021),
  129. ];
  130. }
  131. }
  132.  
  133. SeriesFactory:
  134.  
  135. class SeriesFactory extends Factory
  136. {
  137. /**
  138. * Define the model's default state.
  139. *
  140. * @return array
  141. */
  142. public function definition(): array
  143. {
  144. return [
  145. 'universe_id' => Universe::factory()->create()->id,
  146. 'name' => $this->faker->name(),
  147. ];
  148. }
  149. }
  150.  
  151. TeamFactory:
  152.  
  153. class TeamFactory extends Factory
  154. {
  155. public function definition(): array
  156. {
  157. return [
  158. 'universe_id' => Universe::factory()->create(),
  159. 'full_name' => $this->faker->userName(),
  160. 'short_name' => $this->faker->firstName(),
  161. 'team_principal' => $this->faker->name(),
  162. 'primary_colour' => $this->faker->hexColor(),
  163. 'secondary_colour' => $this->faker->hexColor(),
  164. 'country' => $this->faker->countryCode(),
  165. ];
  166. }
  167. }
  168.  
  169. UniverseFactory:
  170.  
  171. class TeamFactory extends Factory
  172. {
  173. public function definition(): array
  174. {
  175. return [
  176. 'universe_id' => Universe::factory()->create(),
  177. 'full_name' => $this->faker->userName(),
  178. 'short_name' => $this->faker->firstName(),
  179. 'team_principal' => $this->faker->name(),
  180. 'primary_colour' => $this->faker->hexColor(),
  181. 'secondary_colour' => $this->faker->hexColor(),
  182. 'country' => $this->faker->countryCode(),
  183. ];
  184. }
  185. }
  186.  
  187. UserFactory:
  188.  
  189. class UserFactory extends Factory
  190. {
  191. /**
  192. * Define the model's default state.
  193. *
  194. * @return array
  195. */
  196. public function definition(): array
  197. {
  198. return [
  199. 'discord_id' => $this->faker->randomNumber(9),
  200. 'username' => $this->faker->userName(),
  201. 'avatar' => $this->faker->image(),
  202. 'is_admin' => false,
  203. ];
  204. }
  205. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement