Comments (3)
I had the same error. Adding the file worked, but as you can see in the first error, it's referring to the wrong path.
fopen(../database/seeds/CountriesSeeder.php): failed to open stream: No such file or directory at vendor/webpatser/laravel-countries/src/commands/MigrationCommand.php:119
I went to the file MigrationCommand.php and changed the line with the path from $seeder_file = $this->laravel->path . "/../database/seeds/CountriesSeeder.php";
to $seeder_file = $this->laravel->path . "/../database/seeders/CountriesSeeder.php";
.
Mind the path in the first one still being called seeds in stead of seeders.
from laravel-countries.
Here is a workaround.
- Create the file CountriesSeeder.php at database/seeders/ like below:
<?php
namespace Database\Seeders;
use DB;
use Illuminate\Database\Seeder;
use Webpatser\Countries\Countries;
class CountriesSeeder extends Seeder {
/**
* Run the database seeds.
*
* @return void
*/
public function run() {
//Empty the countries table
DB::table(\Config::get('countries.table_name'))->delete();
//Get all of the countries
$countryModel = new Countries();
$countries = $countryModel->getList();
foreach ($countries as $countryId => $country){
DB::table(\Config::get('countries.table_name'))->insert(array(
'id' => $countryId,
'capital' => ((isset($country['capital'])) ? $country['capital'] : null),
'citizenship' => ((isset($country['citizenship'])) ? $country['citizenship'] : null),
'country_code' => $country['country-code'],
'currency' => ((isset($country['currency'])) ? $country['currency'] : null),
'currency_code' => ((isset($country['currency_code'])) ? $country['currency_code'] : null),
'currency_sub_unit' => ((isset($country['currency_sub_unit'])) ? $country['currency_sub_unit'] : null),
'currency_decimals' => ((isset($country['currency_decimals'])) ? $country['currency_decimals'] : null),
'full_name' => ((isset($country['full_name'])) ? $country['full_name'] : null),
'iso_3166_2' => $country['iso_3166_2'],
'iso_3166_3' => $country['iso_3166_3'],
'name' => $country['name'],
'region_code' => $country['region-code'],
'sub_region_code' => $country['sub-region-code'],
'eea' => (bool)$country['eea'],
'calling_code' => $country['calling_code'],
'currency_symbol' => ((isset($country['currency_symbol'])) ? $country['currency_symbol'] : null),
'flag' =>((isset($country['flag'])) ? $country['flag'] : null),
));
}
}
}
- Now run
php artisan db:seed --class=CountriesSeeder
from laravel-countries.
That will fix this issue too. @chadriae
However, changing that will affect other third-party libraries with a seeder in the correct location.
Also, I wouldn't ever recommend changing vendor files directly. Or else they will be overriden by composer. Plus you should avoid tracking vendor with Git.
from laravel-countries.
Related Issues (20)
- Number of decimals for currency missing for some countries HOT 1
- Seeder PHP exception
- Is it possible to get all regions?
- Seeding the countries table getting "Call to undefined method Webpatser\Countries\CountriesFacade::getList()" HOT 4
- 'CountriesSeeder' has no effect HOT 2
- not able to install your plugin HOT 1
- Deprecation notice for Composer v2.0: not-autoloading
- Country England not in the list why? HOT 1
- Your configuration files are not serializable.
- Your code require an update in MigrationCommand
- Seeders folder instead seeds
- Missing options HOT 1
- Change Turkey's name to Türkiye
- Seeding 'CountriesSeeder.php' data did not work due to getList() called on Countries statically.
- Fix char migration for pgsql
- Data Correction
- Artisan optimize command is deprecated as of L5.5 and has already removed it from L5.6
- MTDF FILTER plugin not showing the result in wordpress
- Add pattern for phone
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-countries.