/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { //$limit=3; //$announcement = Announcement::orderBy('created_at','desc')->limit($limit)->get(); $announcement = Announcement::orderBy('created_at', 'desc')->get(); return view('announcements.index', compact('announcement')); }
public function index() { $limit = 3; $announcement = Announcement::orderBy('created_at', 'desc')->limit($limit)->get(); $trainings = Training::orderBy('start_date', 'asc')->get(); return view('bard_frontend.index', compact('announcement'), compact('trainings')); //return view('bard_frontend/index')->with('index', 'active'); }
/** * Show the latest announcement * * @return \Illuminate\Http\Response */ public function latest() { $announcement = Announcement::orderBy('publish_at', 'desc')->where('publish_at', '<', date("Y-m-d H:i:s", time()))->where('unpublish_at', '>', date("Y-m-d H:i:s", time()))->limit(1)->get()->first(); if ($announcement) { return $this->item($announcement, new AnnouncementTransformer()); } else { $this->response->noContent(); } }
public function index() { $limit = 2; $announcement = Announcement::orderBy('created_at', 'desc')->limit($limit)->get(); $now = new Datetime(); $now = $now->format('Y-m-d'); $upcomingTrainings = Training::where('status', '=', 1)->where('start_date', '>', Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $now . ' 00:00:00'))->orderBy('start_date', 'asc')->limit($limit)->get(); $ongoingTrainings = Training::where('status', '=', 1)->where('start_date', '<=', Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $now . ' 00:00:00'))->where('end_date', '>=', Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $now . ' 00:00:00'))->limit($limit)->get(); $all_slider = Slider::orderBy('position', 'asc')->get(); return view('bard_frontend.index', compact('announcement', 'upcomingTrainings', 'ongoingTrainings', 'all_slider')); }
public function adminIndex($category = false) { if ($category !== false) { if ($category == 0) { return redirect('admin/announcements'); } $announcements = Announcement::where('category_id', $category)->with('author', 'category')->orderBy('id', 'desc')->paginate(15); } else { $announcements = Announcement::orderBy('id', 'desc')->with('author', 'category')->paginate(15); } return view('admin.announcements.index', compact('announcements')); }
public static function getAllAnnouncements() { return \App\Announcement::orderBy('id', 'desc')->get(); }
/** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function publicIndex() { $announcement = Announcement::orderBy('created_at', 'desc')->get(); return view('announcements.public_announcement_pages.index', compact('announcement')); }