Upgrade to Pro — share decks privately, control downloads, hide ads and more …

The Right Toolbox

Sponsored · SiteGround - Reliable hosting with speed, security, and support you can count on. →

The Right Toolbox

Choosing the right tool for the job sometimes means bringing along a whole toolbox. I’ll show how a complex back-end system was built with Craft, Laravel, Redis, and more, all working in harmony.

Anthony Colangelo

April 24, 2014

Transcript

79 slides
  1. // ... } class Nominee extends Eloquent { protected $table

    = 'craft_entries_i18n'; private $sectionId = 2;
  2. public function scopeListing($query) { return $query ->select( /* ... */

    ) ->join( /* ... */ ) ->where( /* ... */ ); }
  3. public function scopeListing($query) { return $query ->select( /* ... */

    ) ->join('craft_content', 'craft_content.elementId', '=', 'craft_entries_i18n.entryId') ->join('craft_entries', 'craft_entries.id', '=', 'craft_entries_i18n.entryId') ->join('craft_elements', 'craft_elements.id', '=', 'craft_entries_i18n.entryId') ->where('craft_entries_i18n.sectionId','=',$this->sectionId) ->where('craft_entries.postDate','<=',date_format(new DateTime(),'Y-m-d G:i:s')) ->where(function($query) { $query ->where('craft_entries.expiryDate','=',NULL) ->orWhere('craft_entries.expiryDate','>=',date_format(new DateTime(),'Y-m-d G:i:s')); }) ->where('craft_elements.enabled','=',1); }
  4. public function scopeListing($query) { return $query ->select( /* ... */

    ) ->join( /* ... */ ) ->where( /* ... */ ); }
  5. $redis = Redis::connection('oma4-votes'); ! $voter = "user[{$voterId}]"; $nominee = "nominee[{$nomineeId}]";

    $category = "category[{$categoryId}]"; $influencer = “user[{$influencerId}]”; ! $datetime = new DateTime(); $date['day'] = $datetime->format('Y-m-d'); $date['hour'] = $datetime->format('Y-m-d-H');

More Decks by Anthony Colangelo

Other Decks in Programming