当前位置: 首页>>代码示例>>PHP>>正文


PHP Agent::where方法代码示例

本文整理汇总了PHP中Agent::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Agent::where方法的具体用法?PHP Agent::where怎么用?PHP Agent::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Agent的用法示例。


在下文中一共展示了Agent::where方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getCreditLimit

 public static function getCreditLimit($agent_id)
 {
     if (Entrust::hasRole('Agent')) {
         return Agent::where('user_id', $agent_id)->first()->credit_limit;
     }
     return false;
 }
开发者ID:tharindarodrigo,项目名称:agent,代码行数:7,代码来源:Agent.php

示例2: asyncStatus

 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)]);
     }
 }
开发者ID:victory21th,项目名称:QM-Laravel,代码行数:16,代码来源:StatusController.php

示例3: index

 public function index()
 {
     $param['pageNo'] = 1;
     $agent = AgentModel::find(Session::get('agent_id'));
     $param['is_active'] = $agent->is_active;
     $param['ticketTypes'] = TicketTypeModel::where('company_id', $agent->store->company->id)->get();
     if (Session::has('process_id')) {
         $process = ProcessModel::find(Session::get('process_id'));
         $param['currentQueueNo'] = $process->queue_no;
         $param['lastQueueNo'] = $process->agent->store->status->last_queue_no;
     }
     // Get Store ID
     $storeId = $agent->store_id;
     $status = StatusModel::where('store_id', $storeId)->first();
     $agents = AgentModel::where('store_id', $storeId)->where('is_active', TRUE);
     $param['amountOfQueue'] = $status->last_queue_no - $status->current_queue_no;
     $tickets = ProcessModel::where('agent_id', $agent->id)->whereRaw('DATE(created_at) = DATE(NOW())')->where('end_time', '!=', '');
     $param['ticketsManaged'] = $tickets->count();
     $processTickets = $tickets->get();
     $activeTime = 0;
     foreach ($processTickets as $item) {
         $activeTime += strtotime($item->end_time) - strtotime($item->start_time);
     }
     $param['activeTime'] = $activeTime;
     $param['averageYourTicketTime'] = $tickets->count() == 0 ? 0 : round($activeTime / $tickets->count());
     $agentIds = [];
     $agentIds[] = 0;
     $agents = AgentModel::where('store_id', $storeId)->get();
     foreach ($agents as $agent) {
         $agentIds[] = $agent->id;
     }
     $tickets = ProcessModel::whereIn('agent_id', $agentIds)->whereRaw('DATE(created_at) = DATE(NOW())')->where('end_time', '!=', '');
     $processTickets = $tickets->get();
     $activeTime = 0;
     foreach ($processTickets as $item) {
         $activeTime += strtotime($item->end_time) - strtotime($item->start_time);
     }
     $param['averageTicketTime'] = $tickets->count() == 0 ? 0 : round($activeTime / $tickets->count());
     $prefix = DB::getTablePrefix();
     $sqlType = "SELECT id, name\n                  FROM " . $prefix . "ticket_type\n                 WHERE company_id = " . $agent->store->company->id . "\n                 UNION ALL\n                SELECT 0 as id, 'Skip' as name";
     $sql = "\n                SELECT COUNT(*) AS cnt, IFNULL(ticket_type, 0) AS type\n                  FROM " . $prefix . "process t1, " . $prefix . "agent t2, " . $prefix . "store t3\n                 WHERE t1.agent_id = t2.id\n                   AND t2.store_id = t3.id\n                   AND t1.end_time != ''\n                   AND t3.company_id = " . $agent->store->company->id . "\n                 GROUP BY ticket_type";
     $sql = "SELECT t1.name, IFNULL(t2.cnt, 0) AS cnt\n                  FROM ({$sqlType}) t1\n                  LEFT JOIN ({$sql}) t2\n                    ON t1.id = t2.type\n                 ORDER BY IFNULL(t2.cnt, 0) DESC";
     $param['mostTickets'] = DB::select($sql);
     return View::make('agent.process.index')->with($param);
 }
开发者ID:victory21th,项目名称:QM-Laravel,代码行数:45,代码来源:ProcessController.php

示例4: store

 /**
  * Store a newly created payment in storage.
  *
  * @return Response
  */
 public function store()
 {
     $data = Input::all();
     $user_id = Auth::id();
     $validator = Validator::make(Input::all(), array('amount' => 'required|numeric'));
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     /**
      * Payments are starting from "BK" numbers
      */
     if ($x = Payment::find(Payment::max('id'))) {
         $y = (int) substr($x->reference_number, 2);
         $data['reference_number'] = 'BK' . ++$y;
     } else {
         $data['reference_number'] = 'BK10000000';
     }
     $data['agent_id'] = User::getAgentOfUser(Auth::id());
     if (Entrust::hasRole('Agent')) {
         $agent_id = $data['agent_id']->user_id;
         $name = User::where('id', $user_id)->first()->first_name . ' ' . User::where('id', $user_id)->first()->last_name;
         $email = User::where('id', $user_id)->first()->email;
         $phone = Agent::where('user_id', $user_id)->first()->phone;
         $amount = Input::get('amount');
         $details = Input::get('details');
         $data = array('details' => $name, 'ip_address' => $_SERVER['REMOTE_ADDR'], 'amount' => $amount, 'payment_status' => 0, 'my_booking' => 2);
         $reserv_id = Payment::create($data);
         $data_tab_HSBC_payment = array('currency' => 'USD');
         $tab_HSBC_payment_id = HsbcPayment::create($data_tab_HSBC_payment);
         $stamp = strtotime("now");
         $payment_id = Payment::orderBy('created_at', 'desc')->first()->id;
         $orderid = "{$stamp}" . 'AP' . "{$payment_id}";
         $last_res_resid = str_replace(".", "", $orderid);
         $hsbc_id = HsbcPayment::orderBy('created_at', 'desc')->first()->id;
         $hsbc_payment_id_pre = "{$stamp}" . 'HSBC' . "{$hsbc_id}";
         $hsbc_payment_id = str_replace(".", "", $hsbc_payment_id_pre);
         if ($last_res_resid) {
             $payment = DB::table('payments')->where('id', $payment_id)->update(array('reference_number' => $last_res_resid, 'HSBC_payment_id' => $hsbc_payment_id));
             $data_tab_HSBC_payment = DB::table('hsbc_payments')->where('id', $hsbc_id)->update(array('HSBC_payment_id' => $hsbc_payment_id));
             $client = array('booking_name' => $name, 'email' => $email, 'phone' => $phone, 'remarks' => $details, 'val' => 0, 'payment_reference_number' => $last_res_resid);
             $client_payment_id = Booking::create($client);
         }
         $currency = 'USD';
         $x = $amount * 1.037;
         $total_price_all_hsbc = round($x, 2) * 100;
         //dd($hsbc_payment_id . '/' . $currency . '/' . $total_price_all_hsbc . '/' . $last_res_resid);
         HsbcPayment::goto_hsbc_gateway($hsbc_payment_id, $currency, $total_price_all_hsbc, $last_res_resid);
         //  return $this->storeAllDataAndSendEmails();
     }
     //Payment::create($data);
     return Redirect::route('accounts.payments.index');
 }
开发者ID:tharindarodrigo,项目名称:agent,代码行数:57,代码来源:PaymentsController.php

示例5: getProfile

 public function getProfile()
 {
     if (Entrust::hasRole('Agent')) {
         $agent = Agent::where('user_id', Auth::id())->first();
         return View::make('account.profile.edit', compact('agent'));
     } elseif (Entrust::hasRole('Admin')) {
         $agents = Agent::all();
         return View::make('account.profile.agent-list', compact('agents'));
     }
 }
开发者ID:tharindarodrigo,项目名称:agent,代码行数:10,代码来源:AccountController.php


注:本文中的Agent::where方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。