Code Monkey home page Code Monkey logo

laravel-iso-countries's Issues

Build command does not set translations

From loadNameTranslations() in Build.php

` foreach ($locales as $locale) {

        $file = match ($model) {
            Country::class => __DIR__ . "/../../data/translations/countries/$locale/country.php",
            Language::class => __DIR__ . "/../../data/translations/languages/$locale/language.php",
            Currency::class => __DIR__ . "/../../data/translations/currencies/$locale/currency.php",
        };

        if ( ! file_exists($file)) {
            continue;
        }

        $translations = require $file;

        foreach ($translations as $id => $name) {
            $item = $model::find($id)?->setTranslation('name', $locale, $name)->saveQuietly();
        }

`

The files you look for in the match are non-existent and the translations are never set. This results in only english in the JSON object for a translatable field in the DB. Could you please have a look at this?

infinite loop when casting

Hello

I'm getting this error when trying to cast in my model

ERROR Xdebug has detected a possible infinite loop, and aborted your script with a stack depth of '256' frames in vendor/laravel/framework/src/Illuminate/Foundation/AliasLoader.php on line 73.

i don't have any classes called Language or Country or Currency
Only thing is the model i'm using has the following fields

`class PeopleSpokenLanguage extends Model
{
use HasFactory;

protected $casts = [
    'language' => Language::class,
    'accent' => Country::class

];

}`

Numeric ISO Codes

I noticed the countries table does not include the numeric codes, I prefer storing countries by their numeric codes because they don't change like the 2 or 3 letter ones can, they very rarely change, but still do sometimes.

Error could not find driver

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

Facade issue

Facing an issue when running the following command on laravel 9;

php artisan ide-helper:generate --ansi
Exception: Target class [iso-countries] does not exist.
Skipping \Io238\ISOCountries\ISOCountriesFacade.

In Facade.php line 216:

Illegal offset type in isset or empty

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.