PHP code example of pwweb / localisation

1. Go to this page and download the library: Download pwweb/localisation library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

pwweb / localisation example snippets




return [
    ...
    'locale' => 'en-GB',
    'fallback_locale' => 'en-GB',
    ...
];



namespace Path\To;

use Illuminate\Database\Eloquent\Model;
use PWWEB\Localisation\Traits\HasAddresses;

class MyModel extends Model
{
    use HasAddresses;
}

 ErrorException  : Trying to access array offset on value of type null

  at /var/www/vendor/pwweb/localisation/src/LocalisationServiceProvider.php:107
    103|     protected function registerModelBindings()
    104|     {
    105|         $config = $this->app->config['localisation.models'];
    106|
  > 107|         $this->app->bind(CountryContract::class, $config['country']);
    108|         $this->app->bind(LanguageContract::class, $config['language']);
    109|         $this->app->bind(CurrencyContract::class, $config['currency']);
    110|     }
    111|

  Exception trace:

  1   Illuminate\Foundation\Bootstrap\HandleExceptions::handleError("Trying to access array offset on value of type null", "/var/www/vendor/pwweb/localisation/src/LocalisationServiceProvider.php", [])
      /var/www/vendor/pwweb/localisation/src/LocalisationServiceProvider.php:107

  2   PWWeb\Localisation\LocalisationServiceProvider::registerModelBindings()
      /var/www/vendor/pwweb/localisation/src/LocalisationServiceProvider.php:81

  Please use the argument -v to see more details.