public function getVisuri(Request $req)
 {
     $sort = $req->input('sort', null);
     $week = $req->input('week', null);
     $page = $req->input('page', 0);
     date_default_timezone_set('Europe/Bucharest');
     $startDate = new Carbon(\Config::get('constants.start_date'));
     $currentDate = Carbon::now();
     $endDate = $currentDate;
     $daysDiff = $currentDate->diff($startDate)->days;
     $weeksDiff = floor($daysDiff / 7);
     if (is_null($week)) {
         $week = $weeksDiff;
     }
     if (is_numeric($week) && $week < $weeksDiff) {
         $startDate->addWeeks($week);
         $endDate = $startDate->copy();
         $endDate->addWeek()->subDay();
     } else {
         if ($weeksDiff > 0) {
             $startDate->addWeeks($weeksDiff);
         }
     }
     $query = Dream::with('user');
     $query = Dream::whereBetween('approved_at', [$startDate, $endDate]);
     $totalPages = $query->count() / $this->pageSize;
     if (is_numeric($page) && $page > 0 && $page <= $totalPages) {
         $query->skip($page * $this->pageSize);
     }
     if (!is_null($sort)) {
         \Session::put('dreams_sort', $sort);
     }
     if (\Session::has('dreams_sort')) {
         $sort = \Session::get('dreams_sort');
         switch ($sort) {
             case 'approved_at':
                 $data['models'] = $query->orderBy($sort, 'ASC')->take($this->pageSize)->get();
                 break;
             case 'votes':
                 $data['models'] = $query->orderBy($sort, 'DESC')->take($this->pageSize)->get();
                 break;
         }
     } else {
         $data['models'] = $query->take($this->pageSize)->get();
     }
     $data['totalPages'] = $totalPages;
     $data['totalWeeks'] = $weeksDiff;
     $data['currentWeek'] = $week ? $week : $weeksDiff;
     $data['currentPage'] = $page;
     return view('visuri', $data);
 }