-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
277 additions
and
289 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,23 @@ | ||
<?php | ||
|
||
/* @var $factory \Illuminate\Database\Eloquent\Factory */ | ||
namespace Database\Factories; | ||
|
||
use App\Models\Dlc; | ||
use App\Models\Game; | ||
use App\Models\User; | ||
use Faker\Generator as Faker; | ||
use Illuminate\Database\Eloquent\Factories\Factory; | ||
|
||
$factory->define(Dlc::class, function (Faker $faker) { | ||
return [ | ||
'game_id' => Game::all()->random()->id, | ||
'name' => $faker->unique()->realText(20), | ||
'description' => $faker->paragraph($nbSentences = 1), | ||
'created_user_id' => User::all()->random()->id, | ||
]; | ||
}); | ||
class DlcFactory extends Factory | ||
{ | ||
protected $model = Dlc::class; | ||
|
||
public function definition(): array | ||
{ | ||
return [ | ||
'game_id' => Game::all()->random()->id, | ||
'name' => fake()->unique()->realText(20), | ||
'description' => fake()->paragraph($nbSentences = 1), | ||
'created_user_id' => User::all()->random()->id, | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
namespace Database\Factories; | ||
|
||
use App\Models\Game; | ||
use App\Models\User; | ||
use Carbon\Carbon; | ||
use Illuminate\Database\Eloquent\Factories\Factory; | ||
|
||
class GameFactory extends Factory | ||
{ | ||
protected $model = Game::class; | ||
|
||
public function definition(): array | ||
{ | ||
if (config('igdb.enabled')) { | ||
$igdb = IGDB::select(['name', 'summary', 'id']) | ||
->with(['cover' => ['image_id']]) | ||
->orderBy('first_release_date', 'desc') | ||
->whereNotNull('summary') | ||
->whereNotNull('cover') | ||
->where('aggregated_rating', '>=', 70) | ||
->skip(rand(1, 1000)) | ||
->first(); | ||
|
||
return [ | ||
'name' => $igdb->name, | ||
'description' => $igdb->summary, | ||
'igdb_id' => $igdb->id, | ||
'image' => 'https://images.igdb.com/igdb/image/upload/t_cover_big/'.$igdb->cover->image_id.'.jpg', | ||
'igdb_updated' => Carbon::today(), | ||
'created_user_id' => User::all()->random()->id, | ||
]; | ||
} else { | ||
return [ | ||
'name' => fake()->unique()->realText(20), | ||
'description' => fake()->paragraph($nbSentences = 1), | ||
'created_user_id' => User::all()->random()->id, | ||
]; | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.