Exemplo n.º 1
0
 public function onRun()
 {
     $key = $this->makeKey();
     if (Cache::has($key)) {
         $this->media = $this->page['media'] = Cache::get($key);
     } else {
         $settings = Settings::instance();
         $api = new Instagram();
         $api->setClientID($settings->client_id);
         if ($settings->access_token) {
             $api->setAccessToken($settings->access_token);
         }
         $this->media = $this->page['media'] = $api->getTagMedia($this->property('tag'), array('count' => $this->property('limit', 10)));
         $expires_at = Carbon::now()->addMinutes($this->property('cache'));
         Cache::put($key, $this->media, $expires_at);
     }
 }