Initial Commit
This commit is contained in:
commit
ddf09fe00c
113 changed files with 187148 additions and 0 deletions
40
database/factories/CharacterFactory.php
Normal file
40
database/factories/CharacterFactory.php
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
<?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);
|
||||
}
|
||||
}
|
||||
Reference in a new issue