本文整理汇总了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;
}
示例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;
}
示例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();
}
}
示例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'));
}
示例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);
}
示例6: IndexAction
public function IndexAction()
{
$currentPage = (int) $_GET["page"];
$this->view->setVar("page", $this->getPaginationWithModel(Currency::find(), $currentPage));
}