2017 © Pedro Peláez
 

laravel-library laravel-states

Laravel States is a bundle for Laravel, providing abbreviation, name and country code for US states.

image

adrianmejias/laravel-states

Laravel States is a bundle for Laravel, providing abbreviation, name and country code for US states.

  • Saturday, January 27, 2018
  • by adrianmejias
  • Repository
  • 2 Watchers
  • 5 Stars
  • 10,807 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 5 Forks
  • 0 Open issues
  • 9 Versions
  • 29 % Grown

The README.md

Laravel States

Laravel States is a bundle for Laravel, providing abbreviation, name and country code for US states., (*1)

Currently, I only have US states but additional states from other countries could be added using the country code column., (*2)

Please not that this is for Laravel 5 only., (*3)

Installation

Add adrianmejias/laravel-states to composer.json., (*4)

"adrianmejias/laravel-states": "~1.0"

Run composer update to pull down the latest version of Country List., (*5)

Edit app/config/app.php and add the provider and filter, (*6)

'providers' => [
    AdrianMejias\States\StatesServiceProvider::class,
]

Now add the alias., (*7)

'aliases' => [
    'States' => AdrianMejias\States\StatesFacade::class,
]

Model

You can start by publishing the configuration. This is an optional step, it contains the table name and does not need to be altered. If the default name states suits you, leave it. Otherwise run the following command, (*8)

$ php artisan vendor:publish

Next generate the migration file:, (*9)

$ php artisan states:migration
$ composer dump-autoload

It will generate the <timestamp>_setup_states_table.php migration and the StatesSeeder.php seeder. To make sure the data is seeded insert the following code in the database/seeds/DatabaseSeeder.php, (*10)

$this->call(StatesSeeder::class);

You may now run it with the artisan migrate command:, (*11)

$ php artisan migrate --seed

After running this command the filled states table will be available., (*12)

Example

Example blade formatting:, (*13)

@foreach(States::whereCountryCode('US')->get() as $state)
    {{ $state->name }} {{ $state->country_code }}<br>
@endforeach

Should result in:, (*14)

Alabama US<br>
Arkansas US<br>
Arizona US<br>
...

The Versions

27/01 2018

dev-master

9999999-dev https://github.com/adrianmejias/laravel-states

Laravel States is a bundle for Laravel, providing abbreviation, name and country code for US states.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

laravel states us states united states usa

27/01 2018

1.2.4

1.2.4.0 https://github.com/adrianmejias/laravel-states

Laravel States is a bundle for Laravel, providing abbreviation, name and country code for US states.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

laravel states us states united states usa

10/10 2017

1.2.3

1.2.3.0 https://github.com/adrianmejias/laravel-states

Laravel States is a bundle for Laravel, providing abbreviation, name and country code for US states.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

laravel states us states united states usa

27/03 2017

dev-develop

dev-develop https://github.com/adrianmejias/laravel-states

Laravel States is a bundle for Laravel, providing abbreviation, name and country code for US states.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

laravel states us states united states usa

27/03 2017

1.2.2

1.2.2.0 https://github.com/adrianmejias/laravel-states

Laravel States is a bundle for Laravel, providing abbreviation, name and country code for US states.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

laravel states us states united states usa

26/02 2016

1.2.1

1.2.1.0 https://github.com/adrianmejias/laravel-states

Laravel States is a bundle for Laravel, providing abbreviation, name and country code for US states.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

laravel states us states united states usa

26/02 2016

1.2

1.2.0.0 https://github.com/adrianmejias/laravel-states

Laravel States is a bundle for Laravel, providing abbreviation, name and country code for US states.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

laravel states us states united states usa

03/04 2015

1.1

1.1.0.0 https://github.com/adrianmejias/laravel-states

Laravel States is a bundle for Laravel, providing abbreviation and name for all USA States.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

laravel states us states united states usa

03/04 2015

1.0

1.0.0.0 https://github.com/adrianmejias/laravel-states

Laravel States is a bundle for Laravel, providing abbreviation and name for all USA States.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

laravel states us states united states usa