Exemplo n.º 1
0
 /**
  * @param $view
  */
 public function compose(View $view)
 {
     $viewData = $view->getData();
     $date = array_has($viewData, 'date') && $viewData['date'] ? $viewData['date'] : Carbon::today();
     $calendar = $this->manager->getCalendar(Carbon::today());
     $lastBillboard = $this->billboardsRepository->findNewer();
     $view->with('calendar', $calendar);
     $view->with('date', $date);
     $view->with('lastBillboard', $lastBillboard);
 }
Exemplo n.º 2
0
 /**
  * @param $humanDate
  * @return mixed
  */
 public function index($humanDate = '')
 {
     // Search by title
     if ($humanDate === '' && Input::has('title')) {
         $exhibitions = $this->manager->findByTitleSinceToday(Input::get('title'));
         return View::make('exhibitions.frontend.exhibitions.index', compact('exhibitions'));
     }
     if ($humanDate !== '' && substr($humanDate, 0, 1) === '0') {
         App::abort(404);
     }
     try {
         $englishDate = $this->manager->convertMonthFromHumanToNumber($humanDate);
         $date = Carbon::createFromFormat(ExhibitionsManager::DATE_FORMAT, $englishDate);
         $date->startOfDay();
     } catch (InvalidArgumentException $e) {
         $date = Carbon::today();
     }
     $exhibitions = $this->repository->findByDate($date);
     $calendar = $this->manager->getCalendar($date);
     return View::make('exhibitions.frontend.exhibitions.index', compact('exhibitions', 'date', 'calendar'));
 }