public function index_onDelete()
 {
     if ($checkedIds = post('checked')) {
         foreach ($checkedIds as $itemId) {
             if (!($table = Event::find($itemId))) {
                 continue;
             }
             $table->delete();
         }
         Flash::success('Successfully deleted those events.');
     } else {
         Flash::error('Something just went wrong! :(');
     }
     return $this->listRefresh();
 }
 public function onPlusOne()
 {
     $eventId = post('eventId');
     $date = Carbon::createFromFormat('Y-m-d H:i:s', post('date'))->addDay();
     $minutes = Carbon::now()->diffInMinutes($date);
     $eventName = "event-" . $eventId;
     $event = Event::find($eventId);
     if (!Cookie::get($eventName)) {
         Cookie::queue($eventName, $eventId, $minutes);
         $event->visitors++;
         $data = 1;
     } else {
         Cookie::queue(Cookie::forget($eventName));
         $event->visitors--;
         $data = -1;
     }
     $event->save();
     return ['state' => $data];
 }