8000 GitHub - JackieDo/Timezone-List at 4.x
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

JackieDo/Timezone-List

 
 

Repository files navigation

Feature

  • Render a timezone listbox (select element) in Laravel
  • Render a timezone array in Laravel

Installation

You can install this package through Composer.

  • First, edit your project's composer.json file to require jackiedo/timezonelist:
...
"require": {
	...
    "jackiedo/timezonelist": "4.*"
},
  • Next, update Composer from the Terminal:
$ composer update
  • Once update operation completes, the final step is to add the service provider. Open app/config/app.php, and add a new item to the providers array:
...
'providers' => array(
    ...
    'Jackiedo\Timezonelist\TimezonelistServiceProvider',
),

Usage

1. Render a timezone listbox
  • To do so, use method Timezonelist::create($name).

Example:

Timezonelist::create('timezone');

Method Timezonelist::create() have three parameters:

Timezonelist::create($name, $selected, $attr);

The first parameter is required, but the second and third is optional.

  • The second parameter use to set selected value of list box.

Example:

Timezonelist::create('timezone', 'Asia/Ho_Chi_Minh');
  • The third parameter use to set HTML attribute of select tag.

Example:

Timezonelist::create('timezone', null, 'class="styled"');

You can also add multiple attribute.

Example:

Timezonelist::create('timezone', null, 'id="timezone" class="styled"');

Or you can also add multiple attribute with one array.

Example:

Timezonelist::create('timezone', null, array(
    'id' => 'timezone',
    'class' => 'styled',
    ...
));
2. Render a timezone array

You can also render timezone list as an array. This useful for using through a render form class (or Form Helper) in some framework (such as Laravel). To do so, just use method Timezonelist::toArray().

Example in Laravel:

Form::select('timezone', Timezonelist::toArray(), null, array(
    'class' => 'styled',
    ...
));

Thanks for use

Hopefully, this package is useful to you.

About

A small package use to create a timezone list box in Laravel

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages

0