feat(models): add Country and NonWorkingDays models

This commit is contained in:
2024-08-07 12:45:56 +02:00
parent 5633ff78c6
commit 82f3ef39c9
5 changed files with 113 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
<?php
namespace Database\Seeders;
use App\Models\Country;
use Illuminate\Database\Seeder;
use Illuminate\Database\UniqueConstraintViolationException;
class CountrySeeder extends Seeder
{
private const array COUNTRIES = [
'CZ' => 'Czech Republic',
];
/**
* Run the database seeds.
*/
public function run(): void
{
foreach (static::COUNTRIES as $countryCode => $countryName) {
try {
Country::create(['country_code' => $countryCode, 'name' => $countryName]);
} catch (UniqueConstraintViolationException $e) {
// safe to ignore duplicate entries
}
}
//
}
}