public function article()
 {
     $articles = Blog::orderBy('id', 'DESC')->paginate(5);
     $articles->setPath('');
     $setting = Setting::first();
     return view('sites.article', compact('articles', 'setting'));
 }
Exemple #2
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index(Request $request)
 {
     $blogs = Blog::orderBy('created_at', 'desc')->paginate(5);
     $customPagination = new CustomPagination($blogs);
     if ($request->header('Accept') == 'application/json') {
         return $blogs;
     }
     return view('blogs.index', compact('blogs', 'customPagination'));
 }
 public function getIndex()
 {
     if (!ACL::hasPermission('blog')) {
         return redirect(route('home'))->withErrors(['Você não pode acessar a página de Blog.']);
     }
     $blog = Blog::orderBy('date', 'DESC')->get();
     foreach ($blog as $item) {
         array_set($item, 'date', Carbon::createFromFormat('Y-m-d', $item->date)->format('d/m/Y'));
     }
     return view('admin.blog.index')->with(compact('blog'));
 }
Exemple #4
0
 /**
  * @param string $slug
  * @return \Illuminate\View\View
  */
 public function getBlogFrontend($slug = '')
 {
     if ($slug == '') {
         $blog = Blog::first();
     }
     try {
         $blog = Blog::findBySlugOrIdOrFail($slug);
         $blog->increment('views');
     } catch (ModelNotFoundException $e) {
         return Response::view('404', array(), 404);
     }
     $popular = Blog::orderBy('views', 'DESC')->first();
     // Show the page
     return View('blog.show', compact('blog', 'popular'));
 }
 public function read(Request $request)
 {
     $page = 'blog';
     $websiteSettings = \App\Exceptions\Handler::readFile("websiteSettings.json");
     $pages = Pages::where('slug', '=', $page)->first();
     $date = $request->year . '-' . $request->month . '-' . $request->day;
     $blog = Blog::where('date', '=', $date)->where('slug', '=', $request->slug)->first();
     array_set($blog, "date", Carbon::createFromFormat('Y-m-d', $blog->date));
     //INCREMENT
     Blog::find($blog->blogId)->increment('read');
     //MORE BLOG
     $moreBlog = Blog::orderBy('date', 'desc')->where('blogId', '!=', $blog->blogId)->limit(2)->addSelect('title')->addSelect('date')->addSelect('slug')->get();
     foreach ($moreBlog as $item) {
         array_set($item, "date", Carbon::createFromFormat('Y-m-d', $item->date));
     }
     return view('website.blog.intern')->with(compact('page', 'pages', 'websiteSettings', 'blog', 'moreBlog'));
 }
 public function index()
 {
     $page = 'home';
     $websiteSettings = \App\Exceptions\Handler::readFile("websiteSettings.json");
     $pages = Pages::where('slug', '=', $page)->first();
     $banners = Banners::orderByRaw("RAND()")->get();
     $newsAndReleases = NewsAndReleases::orderBy('date', 'desc')->limit(6)->get();
     foreach ($newsAndReleases as $item) {
         array_set($item, 'date', Carbon::createFromFormat('Y-m-d', $item->date));
     }
     $blog = Blog::orderBy('date', 'desc')->limit(3)->get();
     foreach ($blog as $item) {
         array_set($item, 'date', Carbon::createFromFormat('Y-m-d', $item->date));
     }
     $products = Products::getHomeCategories();
     $workWithUsHomeText = Texts::find($this->homeTextId);
     $workWithUsLink = Texts::find($this->linkId);
     $workWithUsImage = Texts::find($this->imageId);
     $calls = Calls::orderByRaw("RAND()")->limit(3)->get();
     $videoTheTeuto = Texts::find($this->videoTheTeuto);
     return view('website.home')->with(compact('page', 'pages', 'websiteSettings', 'banners', 'newsAndReleases', 'blog', 'products', 'workWithUsHomeText', 'workWithUsLink', 'workWithUsImage', 'calls', 'videoTheTeuto'));
 }
Exemple #7
0
 public function blogListing()
 {
     //
     $blogs = Blog::orderBy('id', 'DESC')->get();
     $titles = 'Blog';
     return view('pages.blog-listing', compact('blogs', 'titles'));
 }
 /**
  * Display a listing of the posts.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     return view('blog.index', ['blogs' => Blog::orderBy('created_at', 'DESC')->paginate(5)]);
 }
 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     return \View::share(['sections' => App\Section::where('parent_id', 0), 'priceRange' => [App\Product::min('price'), App\Product::max('price')], 'favorites' => App\Product::orderBy('views', 'desc')->limit(6)->get(), 'latestPosts' => App\Blog::orderBy('id', 'desc')->limit(4)->get(), 'favSection' => App\Product::orderBy('views', 'desc')->get()->first()->section->name, 'affiliate' => App\Shop::get()]);
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $blogs = Blog::orderBy('created_at', 'DESC')->paginate(3);
     return view('blogs.index', compact('blogs'));
 }
Exemple #11
0
 public function index()
 {
     $blogs = Blog::orderBy("created_at", "DESC")->paginate(20);
     return view("realestateadmin::blog.index", ["blogs" => $blogs]);
 }
 /**
  * Display a listing of the blog.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     return view('backend.blog.index', ['blogs' => Blog::orderBy("created_at", "DESC")->paginate(7)]);
 }
Exemple #13
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     return \View::make('blog', ['title' => 'Blog', 'favorites' => App\Product::orderBy('views', 'desc')->limit(6)->get(), 'posts' => App\Blog::orderBy('id', 'desc')->get()]);
 }
Exemple #14
0
 /**
  * Display a listing of the resource.
  *
  * * GET /
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $blog = Blog::orderBy('created_at', 'DESC')->paginate(10);
     // ->get();
     return view('pages.index')->with('blog', $blog);
 }