Ejemplo n.º 1
0
 /**
  * List all blog.
  *
  * @return Response
  */
 public function index(Request $request)
 {
     // pagination
     $session_type = 'blog';
     if (!$request->session()->has('order_by')) {
         $request->session()->put($session_type . '.order_by', 'created_at');
     }
     if (!$request->session()->has('order_dir')) {
         $request->session()->put($session_type . '.order_dir', 'desc');
     }
     if ($request->order_by) {
         $request->session()->put($session_type . '.order_by', $request->order_by);
     }
     if ($request->order_dir) {
         $request->session()->put($session_type . '.order_dir', $request->order_dir);
     }
     $limit = $request->session()->get('limit');
     $orderby = $request->session()->get($session_type . '.order_by') == 'created_at' ? $request->session()->get($session_type . '.order_by') : $request->session()->get('language') . '.' . $request->session()->get($session_type . '.order_by');
     $blog = Blog::where('shop_id', '=', $request->session()->get('shop'))->where(function ($query) use($request) {
         if ($request->search) {
             return $query->where('en.name', 'LIKE', '%' . $request->search . '%');
         }
     })->orderBy($orderby, $request->session()->get($session_type . '.order_dir'))->paginate($limit);
     $blog->search = $request->search;
     return view('admin/blog/index', ['blog' => $blog]);
 }
Ejemplo n.º 2
0
 /**
  * Show article.
  *
  * @return Response
  */
 public function show($slug)
 {
     $blog = Blog::where('slug', $slug)->first();
     if (!$blog) {
         \App::abort(404);
     }
     return view('themes/kudos/blog/show', ['blog' => $blog]);
 }
Ejemplo n.º 3
0
 /**
  * Show the application dashboard.
  *
  * @return Response
  */
 public function show(Request $request)
 {
     $stats['categories'] = Category::where('shop_id', '=', $request->session()->get('shop'))->count();
     $stats['products'] = Product::where('shop_id', '=', $request->session()->get('shop'))->count();
     $stats['customers'] = User::where('shop_id', '=', $request->session()->get('shop'))->count();
     $stats['pages'] = Page::where('shop_id', '=', $request->session()->get('shop'))->count();
     $stats['blogs'] = Blog::where('shop_id', '=', $request->session()->get('shop'))->count();
     $stats['orders'] = Order::where('shop_id', '=', $request->session()->get('shop'))->count();
     $stats['revenue'] = Order::where('shop_id', '=', $request->session()->get('shop'))->sum('total');
     return view('admin/dashboard', ['stats' => $stats]);
 }
Ejemplo n.º 4
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function getDataBlog()
 {
     $blog = Blog::where('user_id', Auth::user()->getId())->get();
     $images = Auth::user()->getPhoto();
     return view('backend.blog.index', ['images' => $images])->with('blog', $blog);
 }
Ejemplo n.º 5
0
 public function getCategory()
 {
     $blog = Blog::where('category_id', Category::category()->getId())->get();
     return view('beranda.category')->with('blog', $blog);
 }
Ejemplo n.º 6
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($society, $slug)
 {
     $data['soc'] = $society;
     $data['individual'] = Individual::where('slug', '=', $slug)->first();
     if ($data['individual'] and $data['individual']->social) {
         $socials = explode(',', $data['individual']->social);
         foreach ($socials as $social) {
             if (strpos($social, 'twitter')) {
                 $data['socials']['twitter'] = $social;
             } elseif (strpos($social, 'facebook')) {
                 $data['socials']['facebook'] = $social;
             } elseif (strpos($social, 'instagram')) {
                 $data['socials']['instagram'] = $social;
             } elseif (strpos($social, 'youtube')) {
                 $data['socials']['youtube'] = $social;
             }
         }
     }
     if ($data['individual']) {
         $id = $data['individual']->id;
         if (count(Preacher::where('individual_id', '=', $id)->get()) > 0) {
             $data['preacher'] = Preacher::with(array('sermons' => function ($query) {
                 $query->orderBy('created_at', 'DESC');
             }))->where('individual_id', '=', $id)->first();
         } elseif (count(Minister::with('sermons')->where('individual_id', '=', $id)->get()) > 0) {
             $data['preacher'] = Minister::where('individual_id', '=', $id)->first();
         }
         $data['pagetitle'] = $data['individual']->firstname . " " . $data['individual']->surname;
     } else {
         $data['preacher'] = Guest::where('slug', '=', $slug)->first();
         $data['pagetitle'] = $data['preacher']->firstname . " " . $data['preacher']->surname;
         $id = 0;
     }
     if (isset($data['preacher'])) {
         $sermons = $data['preacher']->sermons->lists('id')->all();
         $data['sermons'] = Sermon::wherein('id', $sermons)->orderBy('servicedate', 'DESC')->paginate(5);
     }
     $data['blogs'] = Blog::where('individual_id', '=', $id)->orderBy('created_at', 'DESC')->limit(9)->get();
     return View::make('individuals.show', $data);
 }
Ejemplo n.º 7
0
 public function feed($society)
 {
     $feed = App::make("feed");
     // cache the feed for 60 minutes (second parameter is optional)
     $feed->setCache(0, 'LowerTugelaCircuitFeed');
     // check if there is cached feed and build new only if is not
     if (!$feed->isCached()) {
         $society = Society::where('society', '=', $society)->first();
         // creating rss feed with our most recent 20 posts
         $blogs = Blog::where('created_at', '>', '2016-02-13')->orderBy('created_at', 'desc')->take(20)->get();
         $sermons = Sermon::where('servicedate', '>', '2016-02-13')->orderBy('servicedate', 'desc')->orderBy('created_at', 'desc')->take(20)->get();
         // set your feed's title, description, link, pubdate and language
         $feed->title = $society->society . ' Methodist Church';
         $feed->description = 'Together, a transforming discipleship movement';
         $feed->logo = 'http://church.net.za/public/images/logo.jpg';
         $feed->link = url('feed');
         $feed->setDateFormat('datetime');
         // 'datetime', 'timestamp' or 'carbon'
         $feed->pubdate = date('d-m-Y');
         $feed->lang = 'en';
         $feed->setShortening(true);
         // true or false
         $feed->setTextLimit(120);
         // maximum length of description text
         $feeddata = array();
         foreach ($blogs as $blog) {
             // set item's title, author, url, pubdate, description and content
             if ($blog->blogimage != "") {
                 $imgurl = url($blog->blogimage);
             } elseif ($blog->individual->photo) {
                 $imgurl = url($blog->individual->photo);
             } elseif ($society->logo) {
                 $imgurl = url($society->logo);
             } else {
                 $imgurl = "http://church.net.za/public/images/logo.jpg";
             }
             $fulldescrip = strip_tags($blog->post);
             $dum['title'] = $blog->title;
             $dum['author'] = $imgurl;
             $dum['link'] = url('/blog#' . $blog->id);
             $dum['pubdate'] = $blog->created_at;
             $dum['summary'] = "A new blog post has been published on our site.";
             $dum['content'] = $fulldescrip;
             $feeddata[] = $dum;
         }
         foreach ($sermons as $sermon) {
             // set item's title, author, url, pubdate, description and content
             $seriesimage = url($sermon->series->seriesimage);
             if ($sermon->preachable_type == "App\\Models\\Guest") {
                 $preacher = $sermon->preachable->firstname . " " . $sermon->preachable->surname;
             } else {
                 $preacher = $sermon->preachable->individual->firstname . " " . ($preacher = $sermon->preachable->individual->surname);
             }
             $fulldescrip = "Recording of a sermon preached by " . $preacher . " at " . $society->society . ' Methodist Church on ' . date("l j F Y", strtotime($sermon->servicedate)) . '. Bible readings: ' . $sermon->readings;
             $dum['title'] = $sermon->sermon;
             $dum['author'] = $seriesimage;
             $dum['link'] = url('/sermons/' . $sermon->series->slug . '/' . $sermon->slug);
             $dum['pubdate'] = $sermon->servicedate . " 12:00:00";
             $dum['summary'] = "A new sermon has been uploaded to our site.";
             $dum['content'] = $fulldescrip;
             $feeddata[] = $dum;
         }
         usort($feeddata, function ($a, $b) {
             return strcmp($b["pubdate"], $a["pubdate"]);
         });
     }
     foreach ($feeddata as $fd) {
         $feed->add($fd['title'], $fd['author'], $fd['link'], $fd['pubdate'], $fd['summary'], $fd['content']);
     }
     return $feed->render('atom');
 }