feat(models): add Country and NonWorkingDays models
This commit is contained in:
29
database/seeders/CountrySeeder.php
Executable file
29
database/seeders/CountrySeeder.php
Executable 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
|
||||
}
|
||||
}
|
||||
//
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user