public static function todayOrder($group_id) { $order = OrderUtil::today(); if ($order == null) { $order = new Order(); $lifetime = Admin::getValue($group_id, 'vote_expires'); $time = "+10 min"; if ($lifetime->count() > 0) { $first = $lifetime->first(); $time = $first->value; } if (date("Y-m-d H:i:s A") > date("Y-m-d 10:30:00 AM")) { $order->date = date('Y-m-d H:i:s', strtotime($time)); } else { $order->date = date('Y-m-d 10:30:00'); } $order->user_id = UserUtil::nextUser($group_id)->id; $order->save(); } return $order; }