PHP code example of woodsandwalker / laravel-countries
1. Go to this page and download the library: Download woodsandwalker/laravel-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/ */
woodsandwalker / laravel-countries example snippets
[
'exclude' => ['GB']
]
$countryName = \WW\Countries\Models\Country::whereIsoCode('GB')->first()->name; // United Kingdom
$data = $request->validate([
'country' => ['
Schema::table('users', function (Blueprint $table) {
$table->char('country', 2);
});
class User extends Model
{
/**
* The attributes that should be cast.
*
* @var array
*/
protected $casts = [
'country' => \WW\Countries\Casts\Country::class,
];
}