Skip to content

Instantly share code, notes, and snippets.

View eckenroed's full-sized avatar

Ben Eckenroed eckenroed

  • Salt Lake City, UT
View GitHub Profile
<?php
/**
* Trait helps to allow for some limited overloading of
* methods in the class this is attached to.
*/
trait Overloader {
/**
@eckenroed
eckenroed / Laravel Timezone for Model
Created May 3, 2015 16:15
A simple trait that can be included on any Models in Laravel 5 that will user either the logged in users preferred timezone. or the timezone of the App for displaying all dates, while storing them in UTC in the database. Assumes a "timezone" field in your users table.
<?php
use Carbon\Carbon;
trait Timezone {
protected $defaultTimezone = null;
public function getDefaultTimezone()
{