diff --git a/picquiz/app/Models/Game.php b/picquiz/app/Models/Game.php new file mode 100644 index 0000000..d18a40f --- /dev/null +++ b/picquiz/app/Models/Game.php @@ -0,0 +1,11 @@ + + */ +class GameFactory extends Factory +{ + /** + * Define the model's default state. + * + * @return array + */ + public function definition() + { + return [ + "player" => 1, + ]; + } + + public function len($len){ + return $this->state(function($l) use ($len) { + GamePuzzle::factory()->count($l)->create(); + }); + } +} diff --git a/picquiz/database/factories/GamePuzzleFactory.php b/picquiz/database/factories/GamePuzzleFactory.php new file mode 100644 index 0000000..2306707 --- /dev/null +++ b/picquiz/database/factories/GamePuzzleFactory.php @@ -0,0 +1,31 @@ + + */ +class GamePuzzleFactory extends Factory +{ + /** + * Define the model's default state. + * + * @return array + */ + public function definition() + { + return [ + 'puzzle' => $faker->randomNumber(DB::table('puzzles')->count(), false), + ]; + } + + public function game($id){ + return $this->state(function($i) use ($id) { + return [ + "game" => $i, + ]; + }); + } +}