35 lines
1015 B
PHP
35 lines
1015 B
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\AnagraficaCondominiale;
|
|
use App\Models\Amministratore;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\AnagraficaCondominiale>
|
|
*/
|
|
class AnagraficaCondominialeFactory extends Factory
|
|
{
|
|
protected $model = AnagraficaCondominiale::class;
|
|
|
|
/**
|
|
* Define the model's default state.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'amministratore_id' => function () {
|
|
return Amministratore::factory()->create()->id;
|
|
},
|
|
'codice_univoco' => strtoupper(bin2hex(random_bytes(4))),
|
|
'tipo_soggetto' => 'persona_fisica',
|
|
'nome' => $this->faker->firstName(),
|
|
'cognome' => $this->faker->lastName(),
|
|
'codice_fiscale' => strtoupper(substr(str_shuffle('ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'), 0, 16)),
|
|
];
|
|
}
|
|
}
|