示例#1
0
 /**
  * Fetches RSS items from source
  *
  * @throws ApplicationException
  * @return void
  */
 public function onFetch()
 {
     try {
         $source = Source::findOrFail($this->params[0]);
         if ($source instanceof Source && !$source->getAttribute('is_enabled')) {
             throw new \RuntimeException('Source is not enabled, please enabled it first.');
         }
         Artisan::call('adrenth:fetch-rss', ['source' => $this->params[0]]);
         Flash::success('Successfully fetched RSS items for this source');
     } catch (\Exception $e) {
         throw new ApplicationException('Error while fetching RSS items: ' . $e->getMessage());
     }
 }
示例#2
0
 /**
  * Fetches RSS items from source
  *
  * @throws ApplicationException
  * @return void
  */
 public function onFetch()
 {
     try {
         $source = Source::findOrFail($this->params[0]);
         if ($source instanceof Source && !$source->getAttribute('is_enabled')) {
             throw new SourceNotEnabledException(Lang::get('adrenth.rssfetcher::lang.source.source_not_enabled'));
         }
         Artisan::call('adrenth:fetch-rss', ['source' => $this->params[0]]);
         Flash::success(Lang::get('adrenth.rssfetcher::lang.source.items_fetch_success'));
     } catch (SourceNotEnabledException $e) {
         Flash::warning($e->getMessage());
     } catch (\Exception $e) {
         throw new ApplicationException(Lang::get('adrenth.rssfetcher::lang.source.items_fetch_fail', ['error' => $e->getMessage()]));
     }
 }