Example #1
0
 public function rss()
 {
     $posts = Post::isPublished()->orderBy('published_at', 'desc')->take(10)->get();
     //TODO use options instead of take(10) !
     $last_build_date = \DateTime::createFromFormat('Y-m-d H:i:s', Post::max('created_at'))->format('D, d M Y H:i:s O');
     $content = view('blog::rss')->withPosts($posts)->withLastBuildDate($last_build_date)->withSiteName(Option::get('site_name'));
     return \Response::make($content, '200')->header('Content-Type', 'text/xml');
 }
Example #2
0
 public function ajax_options_save()
 {
     $options = array_except(Input::all(), '_token');
     foreach ($options as $key => $val) {
         $option = Option::firstOrCreate(['name' => $key]);
         $option->value = $val;
         $option->save();
         $ret[] = $option;
     }
     return response()->json($ret);
 }