Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error could not find driver #7

Closed
gbast0s opened this issue Dec 4, 2023 · 3 comments
Closed

Error could not find driver #7

gbast0s opened this issue Dec 4, 2023 · 3 comments

Comments

@gbast0s
Copy link

gbast0s commented Dec 4, 2023

So I have run this command composer require io238/laravel-iso-countries and after that I just tried to call

Country::find("pt"), and I got could not find driver (Connection: iso-countries, SQL: select * from \"countries\")

I have a connection to MySQL database on .env, Am I missing something?

Also when I publish the config and I do not change anything and I try to run the command php artisan db:seed countries:build I got

php artisan db:seed countries:build

   INFO  Seeding database.


   Illuminate\Contracts\Container\BindingResolutionException

  Target class [Database\Seeders\countries:build] does not exist.

  at vendor\laravel\framework\src\Illuminate\Container\Container.php:914
    910▕
    911▕         try {
    912▕             $reflector = new ReflectionClass($concrete);
    913▕         } catch (ReflectionException $e) {
  ➜ 914▕             throw new BindingResolutionException("Target class [$concrete] does not exist.", 0, $e);
    915▕         }
    916▕
    917▕         // If the type is not instantiable, the developer is attempting to resolve
    918▕         // an abstract type such as an Interface or Abstract Class and there is

  1   vendor\laravel\framework\src\Illuminate\Container\Container.php:912
      ReflectionException::("Class "Database\Seeders\countries:build" does not exist")

  2   vendor\laravel\framework\src\Illuminate\Container\Container.php:912
      ReflectionClass::__construct("Database\Seeders\countries:build")

PHP version: 8.1.10
Laravel Framework 10.33.0

@gbast0s
Copy link
Author

gbast0s commented Dec 4, 2023

So I found it was a missing PHP extension

extension=pdo_sqlite

@gbast0s gbast0s closed this as completed Dec 4, 2023
@io238
Copy link
Owner

io238 commented Dec 4, 2023

Thanks for reporting this. I think it will make sense to show better error reporting, if Sqlite is not installed/enabled.

@SomeGuyNamedAlex
Copy link

I just want to come back on this, but for this part :

"Also when I publish the config and I do not change anything and I try to run the command php artisan db:seed countries:build I got"

That error is not related to a missing extension ( Target class [Database\Seeders\countries:build] does not exist. ), but to the fact that the command in README is not valid :

Artisan just thinks countries:build is the seeder, instead of correctly running this as a second command !

Doing php artisan db:seed && php artisan countries:build would solve the

@io238 could you change the README please 🥺

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants