37 lines
868 B
PHP
37 lines
868 B
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\BonusScore;
|
|
use App\Models\Entry;
|
|
use App\Models\User;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
use Illuminate\Support\Carbon;
|
|
|
|
class BonusScoreFactory extends Factory
|
|
{
|
|
protected $model = BonusScore::class;
|
|
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'score' => $this->faker->randomNumber(),
|
|
'created_at' => Carbon::now(),
|
|
'updated_at' => Carbon::now(),
|
|
|
|
'entry_id' => Entry::factory(),
|
|
'user_id' => User::factory(),
|
|
'originally_scored_entry' => Entry::factory(),
|
|
];
|
|
}
|
|
|
|
public function forEntry(Entry $entry): self
|
|
{
|
|
return $this->state(function (array $attributes) use ($entry) {
|
|
return [
|
|
'entry_id' => $entry->id,
|
|
];
|
|
});
|
|
}
|
|
}
|