ldc-legaulois/database/factories/DepartaimantsCollectionFactory.php
2022-02-10 16:14:58 +01:00

46 lines
1.1 KiB
PHP

<?php
namespace Database\Factories;
use App\Enums\DepartaimantCollectionType;
use App\Models\DepartaimantsCollection;
use Illuminate\Database\Eloquent\Factories\Factory;
class DepartaimantsCollectionFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = DepartaimantsCollection::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
$bigNumber = function () {
// prevent the first number from being 0
$output = rand(1, 9);
for ($i = 0; $i < 18; $i++) {
$output .= rand(0, 9);
}
return $output;
};
return [
'type' => array_rand([
DepartaimantCollectionType::current()->value,
DepartaimantCollectionType::vintage()->value
]),
'col1' => $bigNumber(),
'col2' => $bigNumber(),
'col3' => $bigNumber(),
'col4' => rand(0, 160),
];
}
}