Skip to content

Instantly share code, notes, and snippets.

@jakeydevs
Created April 25, 2015 18:54
Show Gist options
  • Save jakeydevs/20bf8b31408f840d1b01 to your computer and use it in GitHub Desktop.
Save jakeydevs/20bf8b31408f840d1b01 to your computer and use it in GitHub Desktop.
<?PHP
$table->increments('id');
$table->string('product');
$table->string('type'); //-- Video type
$table->string('data'); //-- Datas
$table->timestamps();
public function decideAdvert()
{
//-- Pusher
$app_id = '92595';
$app_key = '9de656c016ae635fd977';
$app_secret = 'bb8658547ebce6b4ff06';
$pusher = new Pusher( $app_key, $app_secret, $app_id );
//-- Grab the person
$p = Input::get('p', 'mike');
//-- Grab the device
$d = Input::get('d', 1);
//-- Look for an advert for this person
//-- TODO: Need to get working :)
//-- TODO: Mike and Curtis
if ($p == "mike") {
$a = Advert::where('product', 1)->first();
} else {
$a = Advert::where('product', 2)->first();
}
//-- If no person - lets decide on an ad anyway
$data = array('display' => $d, 'type' => $a->type, 'data' => $a->data);
$pusher->trigger( 'adverts', 'display_advert', ($data) );
echo "<pre>";
print_r($data);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment