aifaiz / myrstates
Laravel 5.* Library for Malaysian states list
Installs: 1 300
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 1
Open Issues: 0
Requires
- php: >=7.1
Requires (Dev)
- phpunit/phpunit: 6.*
This package is auto-updated.
Last update: 2024-06-10 21:18:55 UTC
README
This package is useful for people who would want to create dropdown
input or anything that requires the Malaysian States list.
Installing
$ composer require aifaiz/myrstates
How to use
you can use it in anywhere such as controller
. declare the namespace
like this before the class
use AiFaiz\Malaysia\MyStates;
accessing the states:
$states = MyStates::getStates()
Collections of states will be returned and you can perform collection
method on it. such as:
$states->first()
refer to Collection Methods for more info on utilizing collections
Getting the state name by code
$state = MyStates::stateByCode('KUL')
// Kuala Lumpur
Using Alias
You can use it directly in laravel blade template
like this:
<select>
@foreach(MalayStates::getStates() as $state)
<option value="{{$state['code']}}">{{$state['name']}}</option>
@endforeach
</select>