Archived
1
0
Fork 0
This repository has been archived on 2026-06-16. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
wow-raid-bingo/database/factories/CharacterFactory.php
2021-10-18 11:56:52 +02:00

40 lines
779 B
PHP

<?php
namespace Database\Factories;
use App\Models\Card;
use App\Models\Character as Model;
use Illuminate\Database\Eloquent\Factories\Factory;
class CharacterFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Model::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'name' => $this->faker->firstName(),
];
}
public function cards($count)
{
$cards = Card::factory()
->count($count)
->state(function (array $attr) {
return ['class' => null ];
});
return $this->has($cards);
}
}