Esempio n. 1
0
 /**
  * {@inheritDoc}
  */
 public function render()
 {
     $this->addJs('jquery-ui/jquery-ui.js');
     $this->addCss('jquery-ui/jquery-ui.css');
     $this->addCss('jquery-ui/jquery-ui.theme.css');
     $this->addJs('js/date-picker.js');
     $this->addCss('css/datepicker.css');
     return $this->makePartial('widget', ['current' => date('Y-m-d'), 'week' => DatePicker::dateAgo('-1 week'), 'month' => DatePicker::dateAgo('-1 month'), 'year' => DatePicker::dateAgo('-1 year')]);
 }
Esempio n. 2
0
 public static function processQuery($query, $timestamp, $limit, $cacheKey, $reset = false)
 {
     $get = Request::all();
     if (empty($get)) {
         $get = ['from' => DatePicker::dateAgo('-1 week'), 'to' => date('Y-m-d')];
     }
     $cacheKey .= $get['from'] . $get['to'];
     if ($reset) {
         Cache::forget($cacheKey);
     }
     return Cache::remember($cacheKey, GraphReport::getCacheTime(), function () use($query, $timestamp, $limit, $get) {
         return $query->where($timestamp, '<=', $get['to'])->where($timestamp, '>=', $get['from'])->take($limit)->get();
     });
 }