PHP code example of leonardofilhogm / eloquent-countries

1. Go to this page and download the library: Download leonardofilhogm/eloquent-countries 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/ */

    

leonardofilhogm / eloquent-countries example snippets


use Trato\EloquentCountries\Models\Countries;

Countries::all();
Countries::where('iso2', 'CH')->first();
Countries::where('iso3', 'BRA')->first();
Countries::where('region', 'Europe')->get();

use Trato\EloquentCountries\Rules\IsValidCountryCode;   // ISO 3166-1 alpha-2
use Trato\EloquentCountries\Rules\IsValidCountryCode3;  // ISO 3166-1 alpha-3

$request->validate([
    'country'      => ['
bash
php artisan vendor:publish --tag=eloquent-countries-config
bash
php artisan cache:clear