Laravel queue environment

Ran in to an issue running queue through supervisor. I’ll give a quick rundown of my setup, the issue and solution.

I have supervisor running the queue daemon.

[program:laravel_queue]
command=php /var/www/example.com/artisan queue:listen
autostart=true
autorestart=true
stderr_logfile=/var/log/laraqueue.err.log
stdout_logfile=/var/log/laraqueue.out.log

The key part check on is the env variable isn’t set automatically for the queue. You’ll need to set it via the —env flag.

[program:laravel_queue]
command=php /var/www/example.com/artisan queue:listen --env=prod
autostart=true
autorestart=true
stderr_logfile=/var/log/laraqueue.err.log
stdout_logfile=/var/log/laraqueue.out.log

That’s what I was missing. Once I `sudo supervisorctl restart laravel_queue` all was well with the queue.

Simple Python Web Scraper

I needed a simple html only scraper. (This doesn’t use js, won’t pull down data via AJAX). I found an example on another site, thetaranights.com, but it wasn’t exactly what I needed. It only pulled the data and printed it to screen. I added a list to loop through and auto saving by url name to a html file.

import mechanize  #pip install mechanize

br = mechanize.Browser()
br.set_handle_robots(False)
br.addheaders = [("User-agent","Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101206 Ubuntu/10.10 (maverick) Firefox/3.6.13")]

sign_in = br.open("https://this.example.com/login")  #the login url

br.select_form(nr = 0) #accessing form by their index. Since we have only one form in this example, nr =0.
#br.select_form(name = "form name") Alternatively you may use this instead of the above line if your form has name attribute available.

br["email"] = "email or username" #the key "username" is the variable that takes the username/email value

br["password"] = "password"    #the key "password" is the variable that takes the password value

logged_in = br.submit()   #submitting the login credentials

logincheck = logged_in.read()  #reading the page body that is redirected after successful login

urls = ["https://this.example.com/some/page","https://this.example.com/some/page2"]

for url in urls:
	req = br.open(url).read()
	filename = url.split('/')[-1] + ".html"
	f = open(filename, 'w')
	f.write(req)
	f.close()

Which produces 2 files:
page.html
page2.html

GIT push from one repo to another

Splitting off from a branch to another git repo seems like it would suck. In reality it’s simple. Two lines and you’re set.

Things you’ll need:

  • Source repo pulled down locally
  • Target repo created on your git server (GitHub, BitBucket, GitLab, etc)
  • Url for target git repo
  • Branches

$ cd /path/to/source
$ git remote add [email protected]:my_team/my_awesome_target_repo.git
$ git push targetrepo my_branch_to_create_off_of:master

That’ll create the master branch off of the branch “my_branch_to_create_off_of” from your local repo.

October CMS How to replace component templates from plugins

How can you replace component templates from plugins? IE I want to replace the posts default template in the blog plugin with my own markup. Post List from the blog plugin

— Edit —

Use the override of a template instead. https://octobercms.com/docs/cms/components#overriding-partials

— Old way —

Turns out it is easy, just copy and paste in to your own partial. I typically name mine prefixed with the plug-in. “blog-plugin/post-list.htm”

Then just modify to your specs and insert in the page.

Originally:

{% component 'blogPosts' %}

Becomes:

{% partial 'blog-plugin/posts-list.htm' %}

See the comments below for other solutions. In the docs it notes that you can override the partial that is used.

October CMS set preview post length

October CMS is a brilliant new developer focused CMS. It reminds me of working on XenForo in it’s ease of creating add-ons. A very nice system.

After configuring the blog I needed to limit the post except size for post that didn’t have an except. This meant shrinking the normal content on category list view and post list view. It turned out to be simple.

First open both the blog list template and category list template. Find the code tab and click it.

Then add this:

function onEnd()
{
    if (isset($this['posts']))
        foreach($this['posts'] as &$post) {
            $post->content_html = wordwrap($post->content_html, 250);
            $post->content_html = explode("\n", $post->content_html);
            $post->content_html = $post->content_html[0] . '...';
        }
}

Before is display it’ll be parsed and limited. The code is a bit of code that I modified from SO. I’d link back but can’t find the source thread anymore.

Array list of all timezones

I needed an array of all the timezones so I could insert it in to a database seeder. So I created one off a list from wikipedia.

$timezones = array(
array('abbr'=>'BIT', 'name'=>'Baker Island Time', 'utc'=>'UTC-12'),
array('abbr'=>'NUT', 'name'=>'Niue Time', 'utc'=>'UTC-11'),
array('abbr'=>'SST', 'name'=>'Samoa Standard Time', 'utc'=>'UTC-11'),
array('abbr'=>'CKT', 'name'=>'Cook Island Time', 'utc'=>'UTC-10'),
array('abbr'=>'HAST', 'name'=>'Hawaii-Aleutian Standard Time', 'utc'=>'UTC-10'),
array('abbr'=>'HST', 'name'=>'Hawaii Standard Time', 'utc'=>'UTC-10'),
array('abbr'=>'TAHT', 'name'=>'Tahiti Time', 'utc'=>'UTC-10'),
array('abbr'=>'MART', 'name'=>'Marquesas Islands Time', 'utc'=>'UTC-09:30'),
array('abbr'=>'MIT', 'name'=>'Marquesas Islands Time', 'utc'=>'UTC-09:30'),
array('abbr'=>'AKST', 'name'=>'Alaska Standard Time', 'utc'=>'UTC-09'),
array('abbr'=>'GAMT', 'name'=>'Gambier Islands', 'utc'=>'UTC-09'),
array('abbr'=>'GIT', 'name'=>'Gambier Island Time', 'utc'=>'UTC-09'),
array('abbr'=>'HADT', 'name'=>'Hawaii-Aleutian Daylight Time', 'utc'=>'UTC-09'),
array('abbr'=>'AKDT', 'name'=>'Alaska Daylight Time', 'utc'=>'UTC-08'),
array('abbr'=>'CIST', 'name'=>'Clipperton Island Standard Time', 'utc'=>'UTC-08'),
array('abbr'=>'PST', 'name'=>'Pacific Standard Time (North America)', 'utc'=>'UTC-08'),
array('abbr'=>'MST', 'name'=>'Mountain Standard Time (North America)', 'utc'=>'UTC-07'),
array('abbr'=>'PDT', 'name'=>'Pacific Daylight Time (North America)', 'utc'=>'UTC-07'),
array('abbr'=>'CST', 'name'=>'Central Standard Time (North America)', 'utc'=>'UTC-06'),
array('abbr'=>'EAST', 'name'=>'Easter Island Standard Time', 'utc'=>'UTC-06'),
array('abbr'=>'GALT', 'name'=>'Galapagos Time', 'utc'=>'UTC-06'),
array('abbr'=>'MDT', 'name'=>'Mountain Daylight Time (North America)', 'utc'=>'UTC-06'),
array('abbr'=>'CDT', 'name'=>'Central Daylight Time (North America)', 'utc'=>'UTC-05'),
array('abbr'=>'COT', 'name'=>'Colombia Time', 'utc'=>'UTC-05'),
array('abbr'=>'CST', 'name'=>'Cuba Standard Time', 'utc'=>'UTC-05'),
array('abbr'=>'EASST', 'name'=>'Easter Island Standard Summer Time', 'utc'=>'UTC-05'),
array('abbr'=>'ECT', 'name'=>'Ecuador Time', 'utc'=>'UTC-05'),
array('abbr'=>'EST', 'name'=>'Eastern Standard Time (North America)', 'utc'=>'UTC-05'),
array('abbr'=>'PET', 'name'=>'Peru Time', 'utc'=>'UTC-05'),
array('abbr'=>'VET', 'name'=>'Venezuelan Standard Time', 'utc'=>'UTC-04:30'),
array('abbr'=>'AMT', 'name'=>'Amazon Time (Brazil)[2]', 'utc'=>'UTC-04'),
array('abbr'=>'AST', 'name'=>'Atlantic Standard Time', 'utc'=>'UTC-04'),
array('abbr'=>'BOT', 'name'=>'Bolivia Time', 'utc'=>'UTC-04'),
array('abbr'=>'CDT', 'name'=>'Cuba Daylight Time[3]', 'utc'=>'UTC-04'),
array('abbr'=>'CLT', 'name'=>'Chile Standard Time', 'utc'=>'UTC-04'),
array('abbr'=>'COST', 'name'=>'Colombia Summer Time', 'utc'=>'UTC-04'),
array('abbr'=>'ECT', 'name'=>'Eastern Caribbean Time (does not recognise DST)', 'utc'=>'UTC-04'),
array('abbr'=>'EDT', 'name'=>'Eastern Daylight Time (North America)', 'utc'=>'UTC-04'),
array('abbr'=>'FKT', 'name'=>'Falkland Islands Time', 'utc'=>'UTC-04'),
array('abbr'=>'GYT', 'name'=>'Guyana Time', 'utc'=>'UTC-04'),
array('abbr'=>'PYT', 'name'=>'Paraguay Time (Brazil)[7]', 'utc'=>'UTC-04'),
array('abbr'=>'NST', 'name'=>'Newfoundland Standard Time', 'utc'=>'UTC-03:30'),
array('abbr'=>'NT', 'name'=>'Newfoundland Time', 'utc'=>'UTC-03:30'),
array('abbr'=>'ADT', 'name'=>'Atlantic Daylight Time', 'utc'=>'UTC-03'),
array('abbr'=>'AMST', 'name'=>'Amazon Summer Time (Brazil)[1]', 'utc'=>'UTC-03'),
array('abbr'=>'ART', 'name'=>'Argentina Time', 'utc'=>'UTC-03'),
array('abbr'=>'BRT', 'name'=>'Brasilia Time', 'utc'=>'UTC-03'),
array('abbr'=>'CLST', 'name'=>'Chile Summer Time', 'utc'=>'UTC-03'),
array('abbr'=>'FKST', 'name'=>'Falkland Islands Standard Time', 'utc'=>'UTC-03'),
array('abbr'=>'FKST', 'name'=>'Falkland Islands Summer Time', 'utc'=>'UTC-03'),
array('abbr'=>'GFT', 'name'=>'French Guiana Time', 'utc'=>'UTC-03'),
array('abbr'=>'PMST', 'name'=>'Saint Pierre and Miquelon Standard Time', 'utc'=>'UTC-03'),
array('abbr'=>'PYST', 'name'=>'Paraguay Summer Time (Brazil)', 'utc'=>'UTC-03'),
array('abbr'=>'ROTT', 'name'=>'Rothera Research Station Time', 'utc'=>'UTC-03'),
array('abbr'=>'SRT', 'name'=>'Suriname Time', 'utc'=>'UTC-03'),
array('abbr'=>'UYT', 'name'=>'Uruguay Standard Time', 'utc'=>'UTC-03'),
array('abbr'=>'NDT', 'name'=>'Newfoundland Daylight Time', 'utc'=>'UTC-02:30'),
array('abbr'=>'FNT', 'name'=>'Fernando de Noronha Time', 'utc'=>'UTC-02'),
array('abbr'=>'GST', 'name'=>'South Georgia and the South Sandwich Islands', 'utc'=>'UTC-02'),
array('abbr'=>'PMDT', 'name'=>'Saint Pierre and Miquelon Daylight time', 'utc'=>'UTC-02'),
array('abbr'=>'UYST', 'name'=>'Uruguay Summer Time', 'utc'=>'UTC-02'),
array('abbr'=>'AZOST', 'name'=>'Azores Standard Time', 'utc'=>'UTC-01'),
array('abbr'=>'CVT', 'name'=>'Cape Verde Time', 'utc'=>'UTC-01'),
array('abbr'=>'EGT', 'name'=>'Eastern Greenland Time', 'utc'=>'UTC-01'),
array('abbr'=>'GMT', 'name'=>'Greenwich Mean Time', 'utc'=>'UTC'),
array('abbr'=>'UCT', 'name'=>'Coordinated Universal Time', 'utc'=>'UTC'),
array('abbr'=>'UTC', 'name'=>'Coordinated Universal Time', 'utc'=>'UTC'),
array('abbr'=>'WET', 'name'=>'Western European Time', 'utc'=>'UTC'),
array('abbr'=>'Z', 'name'=>'Zulu Time (Coordinated Universal Time)', 'utc'=>'UTC'),
array('abbr'=>'EGST', 'name'=>'Eastern Greenland Summer Time', 'utc'=>'UTC+00'),
array('abbr'=>'BST', 'name'=>'British Summer Time (British Standard Time from Feb 1968 to Oct 1971)', 'utc'=>'UTC+01'),
array('abbr'=>'CET', 'name'=>'Central European Time', 'utc'=>'UTC+01'),
array('abbr'=>'DFT', 'name'=>'AIX specific equivalent of Central European Time', 'utc'=>'UTC+01'),
array('abbr'=>'IST', 'name'=>'Irish Standard Time', 'utc'=>'UTC+01'),
array('abbr'=>'MET', 'name'=>'Middle European Time Same zone as CET', 'utc'=>'UTC+01'),
array('abbr'=>'WAT', 'name'=>'West Africa Time', 'utc'=>'UTC+01'),
array('abbr'=>'WEDT', 'name'=>'Western European Daylight Time', 'utc'=>'UTC+01'),
array('abbr'=>'WEST', 'name'=>'Western European Summer Time', 'utc'=>'UTC+01'),
array('abbr'=>'CAT', 'name'=>'Central Africa Time', 'utc'=>'UTC+02'),
array('abbr'=>'CEDT', 'name'=>'Central European Daylight Time', 'utc'=>'UTC+02'),
array('abbr'=>'CEST', 'name'=>'Central European Summer Time (Cf. HAEC)', 'utc'=>'UTC+02'),
array('abbr'=>'EET', 'name'=>'Eastern European Time', 'utc'=>'UTC+02'),
array('abbr'=>'HAEC', 'name'=>'Heure Avancée d'Europe Centrale francised name for CEST', 'utc'=>'UTC+02'),
array('abbr'=>'IST', 'name'=>'Israel Standard Time', 'utc'=>'UTC+02'),
array('abbr'=>'MEST', 'name'=>'Middle European Saving Time Same zone as CEST', 'utc'=>'UTC+02'),
array('abbr'=>'SAST', 'name'=>'South African Standard Time', 'utc'=>'UTC+02'),
array('abbr'=>'WAST', 'name'=>'West Africa Summer Time', 'utc'=>'UTC+02'),
array('abbr'=>'AST', 'name'=>'Arabia Standard Time', 'utc'=>'UTC+03'),
array('abbr'=>'EAT', 'name'=>'East Africa Time', 'utc'=>'UTC+03'),
array('abbr'=>'EEDT', 'name'=>'Eastern European Daylight Time', 'utc'=>'UTC+03'),
array('abbr'=>'EEST', 'name'=>'Eastern European Summer Time', 'utc'=>'UTC+03'),
array('abbr'=>'FET', 'name'=>'Further-eastern European Time', 'utc'=>'UTC+03'),
array('abbr'=>'IDT', 'name'=>'Israel Daylight Time', 'utc'=>'UTC+03'),
array('abbr'=>'IOT', 'name'=>'Indian Ocean Time', 'utc'=>'UTC+03'),
array('abbr'=>'SYOT', 'name'=>'Showa Station Time', 'utc'=>'UTC+03'),
array('abbr'=>'IRST', 'name'=>'Iran Standard Time', 'utc'=>'UTC+03:30'),
array('abbr'=>'AMT', 'name'=>'Armenia Time', 'utc'=>'UTC+04'),
array('abbr'=>'AZT', 'name'=>'Azerbaijan Time', 'utc'=>'UTC+04'),
array('abbr'=>'GET', 'name'=>'Georgia Standard Time', 'utc'=>'UTC+04'),
array('abbr'=>'GST', 'name'=>'Gulf Standard Time', 'utc'=>'UTC+04'),
array('abbr'=>'MSK', 'name'=>'Moscow Time', 'utc'=>'UTC+04'),
array('abbr'=>'MUT', 'name'=>'Mauritius Time', 'utc'=>'UTC+04'),
array('abbr'=>'RET', 'name'=>'Réunion Time', 'utc'=>'UTC+04'),
array('abbr'=>'SAMT', 'name'=>'Samara Time', 'utc'=>'UTC+04'),
array('abbr'=>'SCT', 'name'=>'Seychelles Time', 'utc'=>'UTC+04'),
array('abbr'=>'VOLT', 'name'=>'Volgograd Time', 'utc'=>'UTC+04'),
array('abbr'=>'AFT', 'name'=>'Afghanistan Time', 'utc'=>'UTC+04:30'),
array('abbr'=>'AMST', 'name'=>'Armenia Summer Time', 'utc'=>'UTC+05'),
array('abbr'=>'HMT', 'name'=>'Heard and McDonald Islands Time', 'utc'=>'UTC+05'),
array('abbr'=>'MAWT', 'name'=>'Mawson Station Time', 'utc'=>'UTC+05'),
array('abbr'=>'MVT', 'name'=>'Maldives Time', 'utc'=>'UTC+05'),
array('abbr'=>'ORAT', 'name'=>'Oral Time', 'utc'=>'UTC+05'),
array('abbr'=>'PKT', 'name'=>'Pakistan Standard Time', 'utc'=>'UTC+05'),
array('abbr'=>'TFT', 'name'=>'Indian/Kerguelen', 'utc'=>'UTC+05'),
array('abbr'=>'TJT', 'name'=>'Tajikistan Time', 'utc'=>'UTC+05'),
array('abbr'=>'TMT', 'name'=>'Turkmenistan Time', 'utc'=>'UTC+05'),
array('abbr'=>'UZT', 'name'=>'Uzbekistan Time', 'utc'=>'UTC+05'),
array('abbr'=>'IST', 'name'=>'Indian Standard Time', 'utc'=>'UTC+05:30'),
array('abbr'=>'SLST', 'name'=>'Sri Lanka Time', 'utc'=>'UTC+05:30'),
array('abbr'=>'NPT', 'name'=>'Nepal Time', 'utc'=>'UTC+05:45'),
array('abbr'=>'BIOT', 'name'=>'British Indian Ocean Time', 'utc'=>'UTC+06'),
array('abbr'=>'BST', 'name'=>'Bangladesh Standard Time', 'utc'=>'UTC+06'),
array('abbr'=>'BTT', 'name'=>'Bhutan Time', 'utc'=>'UTC+06'),
array('abbr'=>'KGT', 'name'=>'Kyrgyzstan time', 'utc'=>'UTC+06'),
array('abbr'=>'VOST', 'name'=>'Vostok Station Time', 'utc'=>'UTC+06'),
array('abbr'=>'YEKT', 'name'=>'Yekaterinburg Time', 'utc'=>'UTC+06'),
array('abbr'=>'CCT', 'name'=>'Cocos Islands Time', 'utc'=>'UTC+06:30'),
array('abbr'=>'MMT', 'name'=>'Myanmar Time', 'utc'=>'UTC+06:30'),
array('abbr'=>'MST', 'name'=>'Myanmar Standard Time', 'utc'=>'UTC+06:30'),
array('abbr'=>'CXT', 'name'=>'Christmas Island Time', 'utc'=>'UTC+07'),
array('abbr'=>'DAVT', 'name'=>'Davis Time', 'utc'=>'UTC+07'),
array('abbr'=>'HOVT', 'name'=>'Khovd Time', 'utc'=>'UTC+07'),
array('abbr'=>'ICT', 'name'=>'Indochina Time', 'utc'=>'UTC+07'),
array('abbr'=>'KRAT', 'name'=>'Krasnoyarsk Time', 'utc'=>'UTC+07'),
array('abbr'=>'OMST', 'name'=>'Omsk Time', 'utc'=>'UTC+07'),
array('abbr'=>'THA', 'name'=>'Thailand Standard Time', 'utc'=>'UTC+07'),
array('abbr'=>'ACT', 'name'=>'ASEAN Common Time', 'utc'=>'UTC+08'),
array('abbr'=>'AWST', 'name'=>'Australian Western Standard Time', 'utc'=>'UTC+08'),
array('abbr'=>'BDT', 'name'=>'Brunei Time', 'utc'=>'UTC+08'),
array('abbr'=>'CHOT', 'name'=>'Choibalsan', 'utc'=>'UTC+08'),
array('abbr'=>'CIT', 'name'=>'Central Indonesia Time', 'utc'=>'UTC+08'),
array('abbr'=>'CST', 'name'=>'China Standard Time', 'utc'=>'UTC+08'),
array('abbr'=>'CT', 'name'=>'China time', 'utc'=>'UTC+08'),
array('abbr'=>'HKT', 'name'=>'Hong Kong Time', 'utc'=>'UTC+08'),
array('abbr'=>'IRDT', 'name'=>'Iran Daylight Time', 'utc'=>'UTC+08'),
array('abbr'=>'MST', 'name'=>'Malaysia Standard Time', 'utc'=>'UTC+08'),
array('abbr'=>'MYT', 'name'=>'Malaysia Time', 'utc'=>'UTC+08'),
array('abbr'=>'PHT', 'name'=>'Philippine Time', 'utc'=>'UTC+08'),
array('abbr'=>'SGT', 'name'=>'Singapore Time', 'utc'=>'UTC+08'),
array('abbr'=>'SST', 'name'=>'Singapore Standard Time', 'utc'=>'UTC+08'),
array('abbr'=>'ULAT', 'name'=>'Ulaanbaatar Time', 'utc'=>'UTC+08'),
array('abbr'=>'WST', 'name'=>'Western Standard Time', 'utc'=>'UTC+08'),
array('abbr'=>'CWST', 'name'=>'Central Western Standard Time (Australia)', 'utc'=>'UTC+08:45'),
array('abbr'=>'AWDT', 'name'=>'Australian Western Daylight Time', 'utc'=>'UTC+09'),
array('abbr'=>'EIT', 'name'=>'Eastern Indonesian Time', 'utc'=>'UTC+09'),
array('abbr'=>'IRKT', 'name'=>'Irkutsk Time', 'utc'=>'UTC+09'),
array('abbr'=>'JST', 'name'=>'Japan Standard Time', 'utc'=>'UTC+09'),
array('abbr'=>'KST', 'name'=>'Korea Standard Time', 'utc'=>'UTC+09'),
array('abbr'=>'TLT', 'name'=>'Timor Leste Time', 'utc'=>'UTC+09'),
array('abbr'=>'ACST', 'name'=>'Australian Central Standard Time', 'utc'=>'UTC+09:30'),
array('abbr'=>'CST', 'name'=>'Central Standard Time (Australia)', 'utc'=>'UTC+09:30'),
array('abbr'=>'AEST', 'name'=>'Australian Eastern Standard Time', 'utc'=>'UTC+10'),
array('abbr'=>'ChST', 'name'=>'Chamorro Standard Time', 'utc'=>'UTC+10'),
array('abbr'=>'CHUT', 'name'=>'Chuuk Time', 'utc'=>'UTC+10'),
array('abbr'=>'DDUT', 'name'=>'Dumont d'Urville Time', 'utc'=>'UTC+10'),
array('abbr'=>'EST', 'name'=>'Eastern Standard Time (Australia)', 'utc'=>'UTC+10'),
array('abbr'=>'PGT', 'name'=>'Papua New Guinea Time', 'utc'=>'UTC+10'),
array('abbr'=>'VLAT', 'name'=>'Vladivostok Time', 'utc'=>'UTC+10'),
array('abbr'=>'YAKT', 'name'=>'Yakutsk Time', 'utc'=>'UTC+10'),
array('abbr'=>'ACDT', 'name'=>'Australian Central Daylight Time', 'utc'=>'UTC+10:30'),
array('abbr'=>'CST', 'name'=>'Central Summer Time (Australia)', 'utc'=>'UTC+10:30'),
array('abbr'=>'LHST', 'name'=>'Lord Howe Standard Time', 'utc'=>'UTC+10:30'),
array('abbr'=>'AEDT', 'name'=>'Australian Eastern Daylight Time', 'utc'=>'UTC+11'),
array('abbr'=>'KOST', 'name'=>'Kosrae Time', 'utc'=>'UTC+11'),
array('abbr'=>'LHST', 'name'=>'Lord Howe Summer Time', 'utc'=>'UTC+11'),
array('abbr'=>'MIST', 'name'=>'Macquarie Island Station Time', 'utc'=>'UTC+11'),
array('abbr'=>'NCT', 'name'=>'New Caledonia Time', 'utc'=>'UTC+11'),
array('abbr'=>'PONT', 'name'=>'Pohnpei Standard Time', 'utc'=>'UTC+11'),
array('abbr'=>'SAKT', 'name'=>'Sakhalin Island time', 'utc'=>'UTC+11'),
array('abbr'=>'SBT', 'name'=>'Solomon Islands Time', 'utc'=>'UTC+11'),
array('abbr'=>'VUT', 'name'=>'Vanuatu Time', 'utc'=>'UTC+11'),
array('abbr'=>'NFT', 'name'=>'Norfolk Time', 'utc'=>'UTC+11:30'),
array('abbr'=>'FJT', 'name'=>'Fiji Time', 'utc'=>'UTC+12'),
array('abbr'=>'GILT', 'name'=>'Gilbert Island Time', 'utc'=>'UTC+12'),
array('abbr'=>'MAGT', 'name'=>'Magadan Time', 'utc'=>'UTC+12'),
array('abbr'=>'MHT', 'name'=>'Marshall Islands', 'utc'=>'UTC+12'),
array('abbr'=>'NZST', 'name'=>'New Zealand Standard Time', 'utc'=>'UTC+12'),
array('abbr'=>'PETT', 'name'=>'Kamchatka Time', 'utc'=>'UTC+12'),
array('abbr'=>'TVT', 'name'=>'Tuvalu Time', 'utc'=>'UTC+12'),
array('abbr'=>'WAKT', 'name'=>'Wake Island Time', 'utc'=>'UTC+12'),
array('abbr'=>'CHAST', 'name'=>'Chatham Standard Time', 'utc'=>'UTC+12:45'),
array('abbr'=>'NZDT', 'name'=>'New Zealand Daylight Time', 'utc'=>'UTC+13'),
array('abbr'=>'PHOT', 'name'=>'Phoenix Island Time', 'utc'=>'UTC+13'),
array('abbr'=>'TOT', 'name'=>'Tonga Time', 'utc'=>'UTC+13'),
array('abbr'=>'CHADT', 'name'=>'Chatham Daylight Time', 'utc'=>'UTC+13:45'),
array('abbr'=>'LINT', 'name'=>'Line Islands Time', 'utc'=>'UTC+14'),
array('abbr'=>'TKT', 'name'=>'Tokelau Time', 'utc'=>'UTC+14'),
);

Excel: (Download)
TXT Flat File: (Download)

BaseRepositoryInterface Base Eloquent Repository

Here’s a base Eloquent Repository.

interface BaseRepositoryInterface
{
    /**
     * Execute the query and get the first result.
     *
     * @param array  $columns
     * @return \Illuminate\Database\Eloquent\Model|null|static
     * @static
     */
    public function first($columns);

    /**
     * Execute the query and get the first result or throw an exception.
     *
     * @param array  $columns
     * @return \Illuminate\Database\Eloquent\Model
     * @static
     */
    public function firstOrFail($columns);

    /**
     * Execute the query as a "select" statement.
     *
     * @param array  $columns
     * @return \Illuminate\Database\Eloquent\Collection|\Eloquent[]|static[]
     * @static
     */
    public function get($columns);

    /**
     * Pluck a single column from the database.
     *
     * @param string  $column
     * @return mixed|static
     * @static
     */
    public function pluck($column);

    /**
     * Get an array with the values of a given column.
     *
     * @param string  $column
     * @param string  $key
     * @return array
     * @static
     */
    public function lists($column, $key = null);

    /**
     * Get a paginator for the "select" statement.
     *
     * @param int    $perPage
     * @param array  $columns
     * @return \Illuminate\Pagination\Paginator
     * @static
     */
    public function paginate($perPage = null, $columns = array());

    /**
     * Get the hydrated models without eager loading.
     *
     * @param array  $columns
     * @return array
     * @static
     */
    public function getModels($columns = array());

    /**
     * Eager load the relationships for the models.
     *
     * @param array  $models
     * @return array
     * @static
     */
    public function eagerLoadRelations($models);

    /**
     * Add a relationship count condition to the query.
     *
     * @param string  $relation
     * @param string  $operator
     * @param int     $count
     * @param string  $boolean
     * @return \Illuminate\Database\Eloquent\Builder
     * @static
     */
    public function has($relation, $operator = '>=', $count = 1, $boolean = 'and');

    /**
     * Add a relationship count condition to the query with an "or".
     *
     * @param string  $relation
     * @param string  $operator
     * @param int     $count
     * @return \Illuminate\Database\Eloquent\Builder
     * @static
     */
    public function orHas($relation, $operator = '>=', $count = 1);

    /**
     * Get the underlying query builder instance.
     *
     * @return \Illuminate\Database\Query\Builder|static
     * @static
     */
    public function getQuery();
    

    /**
     * Set the underlying query builder instance.
     *
     * @param \Illuminate\Database\Query\Builder  $query
     * @return void
     * @static
     */
    public function setQuery($query);
    

    /**
     * Get the relationships being eagerly loaded.
     *
     * @return array
     * @static
     */
    public function getEagerLoads();
    

    /**
     * Set the relationships being eagerly loaded.
     *
     * @param array  $eagerLoad
     * @return void
     * @static
     */
    public function setEagerLoads($eagerLoad);
    

    /**
     * Get the model instance being queried.
     *
     * @return \Illuminate\Database\Eloquent\Model
     * @static
     */
    public function getModel();
    

    /**
     * Set a model instance for the model being queried.
     *
     * @param \Illuminate\Database\Eloquent\Model  $model
     * @return \Illuminate\Database\Eloquent\Builder
     * @static
     */
    public function setModel($model);
    

    /**
     * Set the columns to be selected.
     *
     * @param array  $columns
     * @return \Illuminate\Database\Query\Builder|static
     * @static
     */
    public function select($columns = array());
    

    /**
     * Add a new select column to the query.
     *
     * @param mixed  $column
     * @return \Illuminate\Database\Query\Builder|static
     * @static
     */
    public function addSelect($column);
    

    /**
     * Force the query to only return distinct results.
     *
     * @return \Illuminate\Database\Query\Builder|static
     * @static
     */
    public function distinct();
    

    /**
     * Set the table which the query is targeting.
     *
     * @param string  $table
     * @return \Illuminate\Database\Query\Builder|static
     * @static
     */
    public function from($table);
    

    /**
     * Add a join clause to the query.
     *
     * @param string  $table
     * @param string  $first
     * @param string  $operator
     * @param string  $second
     * @param string  $type
     * @return \Illuminate\Database\Query\Builder|static
     * @static
     */
    public function join($table, $first, $operator = null, $second = null, $type = 'inner');
    

    /**
     * Add a left join to the query.
     *
     * @param string  $table
     * @param string  $first
     * @param string  $operator
     * @param string  $second
     * @return \Illuminate\Database\Query\Builder|static
     * @static
     */
    public function leftJoin($table, $first, $operator = null, $second = null);
    

    /**
     * Add a basic where clause to the query.
     *
     * @param string  $column
     * @param string  $operator
     * @param mixed   $value
     * @param string  $boolean
     * @return \Illuminate\Database\Query\Builder|static
     * @static
     */
    public function where($column, $operator = null, $value = null, $boolean = 'and');
    

    /**
     * Add an "or where" clause to the query.
     *
     * @param string  $column
     * @param string  $operator
     * @param mixed   $value
     * @return \Illuminate\Database\Query\Builder|static
     * @static
     */
    public function orWhere($column, $operator = null, $value = null);
    

    /**
     * Add a raw where clause to the query.
     *
     * @param string  $sql
     * @param array   $bindings
     * @param string  $boolean
     * @return \Illuminate\Database\Query\Builder|static
     * @static
     */
    public function whereRaw($sql, $bindings = array(), $boolean = 'and');
    

    /**
     * Add a raw or where clause to the query.
     *
     * @param string  $sql
     * @param array   $bindings
     * @return \Illuminate\Database\Query\Builder|static
     * @static
     */
    public function orWhereRaw($sql, $bindings = array());
    

    /**
     * Add a where between statement to the query.
     *
     * @param string  $column
     * @param array   $values
     * @param string  $boolean
     * @return \Illuminate\Database\Query\Builder|static
     * @static
     */
    public function whereBetween($column, $values, $boolean = 'and');
    

    /**
     * Add an or where between statement to the query.
     *
     * @param string  $column
     * @param array   $values
     * @return \Illuminate\Database\Query\Builder|static
     * @static
     */
    public function orWhereBetween($column, $values);
    

    /**
     * Add a nested where statement to the query.
     *
     * @param Closure  $callback
     * @param string   $boolean
     * @return \Illuminate\Database\Query\Builder|static
     * @static
     */
    public function whereNested($callback, $boolean = 'and');
    

    /**
     * Add an exists clause to the query.
     *
     * @param Closure  $callback
     * @param string   $boolean
     * @param bool     $not
     * @return \Illuminate\Database\Query\Builder|static
     * @static
     */
    public function whereExists($callback, $boolean = 'and', $not = false);
    

    /**
     * Add an or exists clause to the query.
     *
     * @param Closure  $callback
     * @param bool     $not
     * @return \Illuminate\Database\Query\Builder|static
     * @static
     */
    public function orWhereExists($callback, $not = false);
    

    /**
     * Add a where not exists clause to the query.
     *
     * @param Closure  $calback
     * @param string   $boolean
     * @return \Illuminate\Database\Query\Builder|static
     * @static
     */
    public function whereNotExists($callback, $boolean = 'and');
    

    /**
     * Add a where not exists clause to the query.
     *
     * @param Closure  $calback
     * @return \Illuminate\Database\Query\Builder|static
     * @static
     */
    public function orWhereNotExists($callback);
    

    /**
     * Add a "where in" clause to the query.
     *
     * @param string  $column
     * @param mixed   $values
     * @param string  $boolean
     * @param bool    $not
     * @return \Illuminate\Database\Query\Builder|static
     * @static
     */
    public function whereIn($column, $values, $boolean = 'and', $not = false);
    

    /**
     * Add an "or where in" clause to the query.
     *
     * @param string  $column
     * @param mixed   $values
     * @return \Illuminate\Database\Query\Builder|static
     * @static
     */
    public function orWhereIn($column, $values);
    

    /**
     * Add a "where not in" clause to the query.
     *
     * @param string  $column
     * @param mixed   $values
     * @param string  $boolean
     * @return \Illuminate\Database\Query\Builder|static
     * @static
     */
    public function whereNotIn($column, $values, $boolean = 'and');
    

    /**
     * Add an "or where not in" clause to the query.
     *
     * @param string  $column
     * @param mixed   $values
     * @return \Illuminate\Database\Query\Builder|static
     * @static
     */
    public function orWhereNotIn($column, $values);
    

    /**
     * Add a "where null" clause to the query.
     *
     * @param string  $column
     * @param string  $boolean
     * @param bool    $not
     * @return \Illuminate\Database\Query\Builder|static
     * @static
     */
    public function whereNull($column, $boolean = 'and', $not = false);
    

    /**
     * Add an "or where null" clause to the query.
     *
     * @param string  $column
     * @return \Illuminate\Database\Query\Builder|static
     * @static
     */
    public function orWhereNull($column);
    

    /**
     * Add a "where not null" clause to the query.
     *
     * @param string  $column
     * @param string  $boolean
     * @return \Illuminate\Database\Query\Builder|static
     * @static
     */
    public function whereNotNull($column, $boolean = 'and');
    

    /**
     * Add an "or where not null" clause to the query.
     *
     * @param string  $column
     * @return \Illuminate\Database\Query\Builder|static
     * @static
     */
    public function orWhereNotNull($column);
    

    /**
     * Handles dynamic "where" clauses to the query.
     *
     * @param string  $method
     * @param string  $parameters
     * @return \Illuminate\Database\Query\Builder|static
     * @static
     */
    public function dynamicWhere($method, $parameters);
    

    /**
     * Add a "group by" clause to the query.
     *
     * @param dynamic  $columns
     * @return \Illuminate\Database\Query\Builder|static
     * @static
     */
    public function groupBy();
    

    /**
     * Add a "having" clause to the query.
     *
     * @param string  $column
     * @param string  $operator
     * @param string  $value
     * @return \Illuminate\Database\Query\Builder|static
     * @static
     */
    public function having($column, $operator = null, $value = null);
    

    /**
     * Add a raw having clause to the query.
     *
     * @param string  $sql
     * @param array   $bindings
     * @param string  $boolean
     * @return \Illuminate\Database\Query\Builder|static
     * @static
     */
    public function havingRaw($sql, $bindings = array(), $boolean = 'and');
    

    /**
     * Add a raw or having clause to the query.
     *
     * @param string  $sql
     * @param array   $bindings
     * @return \Illuminate\Database\Query\Builder|static
     * @static
     */
    public function orHavingRaw($sql, $bindings = array());
    

    /**
     * Add an "order by" clause to the query.
     *
     * @param string  $column
     * @param string  $direction
     * @return \Illuminate\Database\Query\Builder|static
     * @static
     */
    public function orderBy($column, $direction = 'asc');
    

    /**
     * Set the "offset" value of the query.
     *
     * @param int  $value
     * @return \Illuminate\Database\Query\Builder|static
     * @static
     */
    public function skip($value);
    

    /**
     * Set the "limit" value of the query.
     *
     * @param int  $value
     * @return \Illuminate\Database\Query\Builder|static
     * @static
     */
    public function take($value);
    

    /**
     * Set the limit and offset for a given page.
     *
     * @param int  $page
     * @param int  $perPage
     * @return \Illuminate\Database\Query\Builder|static
     * @static
     */
    public function forPage($page, $perPage = 15);
    

    /**
     * Add a union statement to the query.
     *
     * @param \Illuminate\Database\Query\Builder|\Closure  $query
     * @param bool $all
     * @return \Illuminate\Database\Query\Builder|static
     * @static
     */
    public function union($query, $all = false);
    

    /**
     * Add a union all statement to the query.
     *
     * @param \Illuminate\Database\Query\Builder|\Closure  $query
     * @return \Illuminate\Database\Query\Builder|static
     * @static
     */
    public function unionAll($query);
    

    /**
     * Get the SQL representation of the query.
     *
     * @return string
     * @static
     */
    public function toSql();
    

    /**
     * Indicate that the query results should be cached.
     *
     * @param int  $minutes
     * @param string  $key
     * @return \Illuminate\Database\Query\Builder|static
     * @static
     */
    public function remember($minutes, $key = null);
    

    /**
     * Execute the query as a fresh "select" statement.
     *
     * @param array  $columns
     * @return array
     * @static
     */
    public function getFresh($columns = array());
    

    /**
     * Execute the query as a cached "select" statement.
     *
     * @param array  $columns
     * @return array
     * @static
     */
    public function getCached($columns = array());
    

    /**
     * Get a unique cache key for the complete query.
     *
     * @return string
     * @static
     */
    public function getCacheKey();
    

    /**
     * Generate the unique cache key for the query.
     *
     * @return string
     * @static
     */
    public function generateCacheKey();
    

    /**
     * Concatenate values of a given column as a string.
     *
     * @param string  $column
     * @param string  $glue
     * @return string
     * @static
     */
    public function implode($column, $glue = null);
    

    /**
     * Build a paginator instance from a raw result array.
     *
     * @param \Illuminate\Pagination\Environment  $paginator
     * @param array  $results
     * @param int    $perPage
     * @return \Illuminate\Pagination\Paginator
     * @static
     */
    public function buildRawPaginator($paginator, $results, $perPage);
    

    /**
     * Get the count of the total records for pagination.
     *
     * @return int
     * @static
     */
    public function getPaginationCount();
    

    /**
     * Determine if any rows exist for the current query.
     *
     * @return bool
     * @static
     */
    public function exists();
    

    /**
     * Retrieve the "count" result of the query.
     *
     * @param string  $column
     * @return int
     * @static
     */
    public function count($column = '*');
    

    /**
     * Retrieve the minimum value of a given column.
     *
     * @param string  $column
     * @return mixed
     * @static
     */
    public function min($column);
    

    /**
     * Retrieve the maximum value of a given column.
     *
     * @param string  $column
     * @return mixed
     * @static
     */
    public function max($column);
    

    /**
     * Retrieve the sum of the values of a given column.
     *
     * @param string  $column
     * @return mixed
     * @static
     */
    public function sum($column);
    

    /**
     * Retrieve the average of the values of a given column.
     *
     * @param string  $column
     * @return mixed
     * @static
     */
    public function avg($column);
    

    /**
     * Execute an aggregate function on the database.
     *
     * @param string  $function
     * @param array   $columns
     * @return mixed
     * @static
     */
    public function aggregate($function, $columns = array());
    

    /**
     * Insert a new record into the database.
     *
     * @param array  $values
     * @return bool
     * @static
     */
    public function insert($values);
    

    /**
     * Insert a new record and get the value of the primary key.
     *
     * @param array   $values
     * @param string  $sequence
     * @return int
     * @static
     */
    public function insertGetId($values, $sequence = null);
    

    /**
     * Run a truncate statement on the table.
     *
     * @return void
     * @static
     */
    public function truncate();
    

    /**
     * Merge an array of where clauses and bindings.
     *
     * @param array  $wheres
     * @param array  $bindings
     * @return void
     * @static
     */
    public function mergeWheres($wheres, $bindings);
    

    /**
     * Get a copy of the where clauses and bindings in an array.
     *
     * @return array
     * @static
     */
    public function getAndResetWheres();
    

    /**
     * Create a raw database expression.
     *
     * @param mixed  $value
     * @return \Illuminate\Database\Query\Expression
     * @static
     */
    public function raw($value);
    

    /**
     * Get the current query value bindings.
     *
     * @return array
     * @static
     */
    public function getBindings();
    

    /**
     * Set the bindings on the query builder.
     *
     * @param array  $bindings
     * @return void
     * @static
     */
    public function setBindings($bindings);
    

    /**
     * Merge an array of bindings into our bindings.
     *
     * @param \Illuminate\Database\Query\Builder  $query
     * @return \Illuminate\Database\Query\Builder|static
     * @static
     */
    public function mergeBindings($query);
    

    /**
     * Get the database query processor instance.
     *
     * @return \Illuminate\Database\Query\Processors\Processor
     * @static
     */
    public function getProcessor();
    

    /**
     * Get the query grammar instance.
     *
     * @return \Illuminate\Database\Grammar
     * @static
     */
    public function getGrammar();
}