Skip to content

Commit

Permalink
Merge pull request #9603 from portabilis/factories
Browse files Browse the repository at this point in the history
Factories e melhorias
  • Loading branch information
edersoares authored Sep 5, 2023
2 parents e67f76d + 85da484 commit edc9876
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/.build
/database/backups
/database/data
/database/migrations/extras
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@
"sort-packages": true,
"optimize-autoloader": true,
"allow-plugins": {
"dex/composer-plug-and-play": true
"dex/composer-plug-and-play": true,
"pestphp/pest-plugin": true
}
},
"minimum-stability": "dev",
Expand Down
18 changes: 13 additions & 5 deletions config/frontier.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

'frontier' => [

'type' => env('FRONTIER_TYPE', 'view'),

'endpoint' => env('FRONTIER_ENDPOINT', 'frontier'),

'view' => env('FRONTIER_VIEW', 'frontier::index'),
Expand All @@ -13,8 +15,6 @@
'frontier' => env('FRONTIER_VIEWS_PATH') ? base_path(env('FRONTIER_VIEWS_PATH')) : __DIR__ . '/../resources/html',
],

'type' => env('FRONTIER_TYPE', 'view'),

// https://laravel.com/docs/packages#publishing-views
// https://laravel.com/docs/packages#publishing-file-groups
'publishes' => [
Expand All @@ -31,10 +31,18 @@
'ieducar.checkresetpassword',
],

'replaces' => [
env('FRONTIER_FIND') => env('FRONTIER_REPLACE_WITH'),
],
'replaces' => array_combine(
array_filter(explode(',', env('FRONTIER_FIND', ''))),
array_filter(explode(',', env('FRONTIER_REPLACE_WITH', ''))),
),

'proxy' => array_filter(explode(',', env('FRONTIER_PROXY', ''))),

'cache' => env('FRONTIER_CACHE', true),

'headers' => [
'Accept' => 'text/html',
],
],

];
1 change: 1 addition & 0 deletions database/factories/LegacyCourseFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public function definition(): array
'hora_falta' => 0.75,
'ativo' => 1,
'modalidade_curso' => ModalidadeCurso::ENSINO_REGULAR,
'data_cadastro' => now(),
];
}

Expand Down
18 changes: 18 additions & 0 deletions database/factories/LegacyIndividualFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,24 @@ public function current(): LegacyIndividual
]);
}

public function withName(string $name): static
{
return $this->afterCreating(function (LegacyIndividual $individual) use ($name) {
$individual->person->nome = $name;
});
}

public function withDocument(?string $rg = null, ?string $birthCertificate = null): static
{
return $this->afterCreating(function (LegacyIndividual $individual) use ($rg, $birthCertificate) {
LegacyDocumentFactory::new()->create([
'idpes' => $individual->getKey(),
'rg' => $rg,
'certidao_nascimento' => $birthCertificate,
]);
});
}

public function withAge(int $age): static
{
$year = now()->year - $age;
Expand Down

0 comments on commit edc9876

Please sign in to comment.