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


PHP Currency::find方法代码示例

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


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

示例1: getCurrencyDecimalPlaces

 /**
  * Get the number of decimal places in the currency.
  *
  * @return integer
  */
 public function getCurrencyDecimalPlaces()
 {
     if ($currency = Currency::find($this->getCurrency())) {
         return $currency->getDecimals();
     }
     return 2;
 }
开发者ID:gregoriohc,项目名称:argentum-common,代码行数:12,代码来源:CurrencyableTrait.php

示例2: getSelectedCurrency

 static function getSelectedCurrency($db)
 {
     if (!isset(Currency::$selected_currency_cache)) {
         $currencies = Currency::all($db);
         if (isset($_COOKIE['currency'])) {
             $selected_currency_id = $_COOKIE['currency'];
             $selected_currency = Currency::find($currencies, 'currency_id', $selected_currency_id);
         }
         if (!isset($selected_currency)) {
             $selected_currency = Currency::find($currencies, 'currency_value', 1);
         }
         Currency::$selected_currency_cache = $selected_currency;
     }
     return Currency::$selected_currency_cache;
 }
开发者ID:lotcz,项目名称:zshop,代码行数:15,代码来源:currency.m.php

示例3: assignAction

 /**
  * Shows the view to create (edit) engine
  */
 public function assignAction()
 {
     $id = $this->dispatcher->getParams()[0];
     // check "edit" or "new" action in use
     $engine = $id === null ? new Engines() : Engines::findFirst($id);
     if (!$engine instanceof Engines) {
         return $this->response->redirect(['for' => 'dashboard-full', 'controller' => $this->router->getControllerName(), 'action' => $this->router->getActionName()]);
     }
     try {
         // handling POST data
         if ($this->request->isPost()) {
             $engines = $engine->setName($this->request->getPost('name'))->setDescription($this->request->getPost('description'), null, '')->setHost($this->request->getPost('host'))->setCode($this->request->getPost('code'))->setCurrencyId($this->request->getPost('currency_id', null, 1))->setStatus($this->request->getPost('status', null, 0));
             if (!$engines->save()) {
                 // the store failed, the following message were produced
                 foreach ($engines->getMessages() as $message) {
                     $this->flashSession->error((string) $message);
                 }
                 // forward does not working correctly with this  action type
                 // by the way this handle need to remove in another action (
                 return $this->response->redirect(['for' => 'dashboard-full', 'controller' => $this->router->getControllerName(), 'action' => $this->router->getActionName()]);
             } else {
                 // saved successfully
                 if (!isset($id)) {
                     $this->flashSession->success('The engine was successfully added!');
                 } else {
                     $this->flashSession->success('The engine was successfully updated!');
                 }
                 // forward does not working correctly with this  action type
                 // by the way this handle need to remove in another action (
                 return $this->response->redirect(['for' => 'dashboard-full', 'controller' => $this->router->getControllerName()]);
             }
         }
         // build meta data
         $title = !isset($id) ? 'Add' : 'Edit';
         $this->tag->prependTitle($title . ' - ' . self::NAME);
         // add crumb to chain (name, link)
         $this->_breadcrumbs->add(self::NAME, $this->url->get(['for' => 'dashboard-controller', 'controller' => 'engines']))->add($title);
         // set variables output to view
         $this->view->setVars(['title' => $title, 'form' => new Forms\EngineForm(null, ['currency' => Currency::find(), 'default' => isset($id) ? $engine : null])]);
     } catch (\Phalcon\Exception $e) {
         echo $e->getMessage();
     }
 }
开发者ID:stanislav-web,项目名称:phalcon-development,代码行数:46,代码来源:CategoriesController.php

示例4: edit

 /**
  * Show the form for editing the specified currency.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $currency = Currency::find($id);
     return View::make('currencies.edit', compact('currency'));
 }
开发者ID:kenkode,项目名称:xaraerp,代码行数:11,代码来源:CurrenciesController.php

示例5: getPayments

 public function getPayments()
 {
     $to = Input::get('to');
     $from = Input::get('from');
     if ($from == null || $to == null) {
         $today = LocationController::getTime();
         $todayFrom = $today['date'] . ' 00:00:00';
         $todayTo = $today['date'] . ' 23:59:59';
     } else {
         $todayFrom = $from . ' 00:00:00';
         $todayTo = $to . ' 23:59:59';
     }
     try {
         $results = Payment::where('created_at', '>', $todayFrom)->where('created_at', '<', $todayTo)->get()->toArray();
         if (!is_null($results)) {
             foreach ($results as $key => $payment) {
                 $driver = Driver::where('id', '=', $payment['driver_id'])->first()->toArray();
                 $currency = Currency::find($payment['currency'])->pluck('currency');
                 $results[$key]['driver_name'] = $driver['first'] . ' ' . $driver['last'];
                 $results[$key]['currency'] = $currency;
             }
         }
         $queries = DB::getQueryLog();
         $last_query = end($queries);
     } catch (Exception $ex) {
         \Log::error(__METHOD__ . ' | error :' . print_r($ex, 1));
     }
     //\Log::info(__METHOD__.print_r($results, 1));
     return json_encode($results);
 }
开发者ID:ardyaryan,项目名称:presidential-car-api,代码行数:30,代码来源:AdminController.php

示例6: IndexAction

 public function IndexAction()
 {
     $currentPage = (int) $_GET["page"];
     $this->view->setVar("page", $this->getPaginationWithModel(Currency::find(), $currentPage));
 }
开发者ID:willmontiel,项目名称:sayvot,代码行数:5,代码来源:CurrencyController.php


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