refactor: extract rate formatting logic to RateService and add tests
هذا الالتزام موجود في:
@@ -19,6 +19,14 @@ class CityFactory extends Factory
|
||||
{
|
||||
return [
|
||||
'name' => fake()->randomElement(City::supportedCities()),
|
||||
|
||||
'label' => function ($attributes) {
|
||||
return match ($attributes['name']) {
|
||||
City::SANAA => 'صنعاء',
|
||||
City::ADEN => 'عدن',
|
||||
default => $attributes['name'],
|
||||
};
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
@@ -26,7 +34,6 @@ class CityFactory extends Factory
|
||||
{
|
||||
return $this->state([
|
||||
'name' => City::SANAA,
|
||||
'label' => 'صنعاء',
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -34,7 +41,6 @@ class CityFactory extends Factory
|
||||
{
|
||||
return $this->state([
|
||||
'name' => City::ADEN,
|
||||
'label' => 'عدن',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,18 +16,13 @@ class DatabaseSeeder extends Seeder
|
||||
public function run(): void
|
||||
{
|
||||
// currencies
|
||||
$saudiRial = Currency::factory()->saudiRial()->create();
|
||||
$usdDollar = Currency::factory()->usdDollar()->create();
|
||||
$saudiRial = Currency::factory()->saudiRial()->create();
|
||||
|
||||
// cities
|
||||
$sanaa = City::factory()->sanaa()->create();
|
||||
$aden = City::factory()->aden()->create();
|
||||
|
||||
// rates
|
||||
Rate::factory()->recycle($usdDollar)->recycle($sanaa)->create();
|
||||
Rate::factory()->recycle($usdDollar)->recycle($aden)->create();
|
||||
|
||||
Rate::factory()->recycle($saudiRial)->recycle($sanaa)->create();
|
||||
Rate::factory()->recycle($saudiRial)->recycle($aden)->create();
|
||||
// we will seed rates with commands instead
|
||||
}
|
||||
}
|
||||
|
||||
المرجع في مشكلة جديدة
حظر مستخدم