PHP Class Webpatser\Countries\Countries

Inheritance: extends Jenssegers\Mongodb\Model
Show file Open project: webpatser/laravel-countries Class Usage Examples

Protected Properties

Property Type Description
$countries string Path to the directory containing countries data.
$table string The table for the countries in the database, is "countries" by default.

Public Methods

Method Description
__construct ( ) : void Constructor.
getList ( $sort = null ) : array Returns a list of countries
getListForSelect ( $display = 'name' ) : array Returns a list of countries suitable to use with a select element in Laravelcollective\html Will show the value and sort by the column specified in the display attribute
getOne ( string $id ) : array Returns one country

Protected Methods

Method Description
getCountries ( ) : array Get the countries from the JSON file, if it hasn't already been loaded.

Method Details

__construct() public method

Constructor.
public __construct ( ) : void
return void

getCountries() protected method

Get the countries from the JSON file, if it hasn't already been loaded.
protected getCountries ( ) : array
return array

getList() public method

Returns a list of countries
public getList ( $sort = null ) : array
return array

getListForSelect() public method

Returns a list of countries suitable to use with a select element in Laravelcollective\html Will show the value and sort by the column specified in the display attribute
public getListForSelect ( $display = 'name' ) : array
return array

getOne() public method

Returns one country
public getOne ( string $id ) : array
$id string The country id
return array

Property Details

$countries protected property

Path to the directory containing countries data.
protected string $countries
return string

$table protected property

The table for the countries in the database, is "countries" by default.
protected string $table
return string