public function index() { $setting = SettingModel::where('company_id', Session::get('company_id')); $setting = $setting->first(); $param['pageNo'] = 5; $param['setting'] = $setting; if ($alert = Session::get('alert')) { $param['alert'] = $alert; } return View::make('company.setting.index')->with($param); }
public function asyncStatus() { $token = Input::get('token'); $store = StoreModel::where('token', $token)->first(); $agents = AgentModel::where('store_id', $store->id)->where('is_active', true)->get(); $current = $store->status->current_queue_no; $last = $store->status->last_queue_no; $counter = count($agents); if ($counter == 0) { return Response::json(['result' => 'failed', 'msg' => 'There is no active Agent', 'last' => $last]); } else { $companySetting = CompanySettingModel::where('company_id', $store->company_id)->first(); $waitingTime = ceil(($last - $current) / $counter) * $companySetting->waiting_time; return Response::json(['result' => 'success', 'current' => $current, 'last' => $last, 'counter' => $counter, 'waitingTime' => round($waitingTime / 60, 1)]); } }