Beispiel #1
0
 /**
  * Return redirect - creates new feed
  *
  * @return \Illuminate\View\View
  */
 public function store($team)
 {
     $name = Input::get('name');
     $team = Team::where('slug', '=', $team)->first();
     $feed = new Feed();
     $feed->title = $name;
     $feed->team_id = $team->id;
     $feed->save();
     return redirect('/team/' . $team->slug . '/feed');
 }
Beispiel #2
0
 public function newrssfeed()
 {
     //check if url is set in POST argument, else exit
     if (!isset($_POST['url'])) {
         exit;
     }
     //check if url is valid
     if (filter_var($_POST['url'], FILTER_VALIDATE_URL) === false) {
         exit;
     }
     $feedFactory = new FeedFactory(['cache.enabled' => false]);
     $feeder = $feedFactory->make($_POST['url']);
     $simplePieInstance = $feeder->getRawFeederObject();
     if (!empty($simplePieInstance)) {
         echo $simplePieInstance->get_title() . '<br>';
         echo $simplePieInstance->get_description() . '<br>';
         echo $simplePieInstance->get_permalink() . '<br>';
         //favicon has been deprecated: $simplePieInstance->get_favicon();
         $Result = Feed::where('url', $simplePieInstance->get_permalink())->first();
         if (!empty($Result)) {
             echo '<br>Feed already exists!';
         } else {
             $feed = new Feed();
             $feed->category_id = '1';
             $feed->feed_name = $simplePieInstance->get_title();
             $feed->feed_desc = $simplePieInstance->get_description();
             $feed->url = $simplePieInstance->get_permalink();
             $feed->favicon = $simplePieInstance->get_image_url();
             $feed->save();
             echo '<br>Feed added to the database!';
         }
     }
 }