PHP code example of netcore / module-country

1. Go to this page and download the library: Download netcore/module-country 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/ */

    

netcore / module-country example snippets


country()->all();

$country = country()->findByCode('SE');
$country->code; // SE
$country->name; // Sweden
$country->capital; // Stockholm
$country->full_name; // Kingdom of Sweden
$country->calling_code; // 46
$country->eea; // true
$country->flag_url; // Will return asset URL to the country flag

country()->getSelectList();

public function country(): Illuminate\Database\Eloquent\Relations\BelongsTo
{
    return $this->belongsTo(Modules\Country\Models\Country::class);
}

public function currency(): Illuminate\Database\Eloquent\Relations\BelongsTo
{
    return $this->belongsTo(Modules\Country\Models\Currency::class);
}

php artisan module:publish-config Country
php artisan module:publish-migration Country
php artisan module:publish Country
php artisan migrate

php artisan module:seed Country