Esempio n. 1
0
 public function __construct()
 {
     parent::__construct();
     $this->flickrApiKey = Config::get('keys.flickrKey');
     $this->flickrSecret = Config::get('keys.flickrSecret');
     $this->flickrApi = new Api($this->flickrApiKey, $this->flickrSecret);
 }
 /**
  * Ensures that the current API Key is valid.
  *
  * @return bool
  * @throws \Exception
  */
 protected function checkApiKey()
 {
     $this->loadApiKey();
     $validApiKeys = Config::get('keys.apiKeys');
     if (!is_array($validApiKeys)) {
         throw new \Exception("No API keys could be found.");
     }
     if (!in_array($this->apiKey, $validApiKeys)) {
         $this->respond(['error' => 'Invalid API Key.'], 400);
     }
     return true;
 }