本文整理汇总了PHP中Tree::getDepositsCompared方法的典型用法代码示例。如果您正苦于以下问题:PHP Tree::getDepositsCompared方法的具体用法?PHP Tree::getDepositsCompared怎么用?PHP Tree::getDepositsCompared使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tree
的用法示例。
在下文中一共展示了Tree::getDepositsCompared方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doDepositCalculation
public function doDepositCalculation()
{
App::setLocale(Cookie::get('locale', 'ru'));
$isMain = intval(Input::get('is_main'));
$depositAmount = intval(trim(Input::get('deposit_amount')));
$term = intval(trim(Input::get('term')));
$monthlyInstallment = intval(trim(Input::get('monthly_installment')));
$currency = trim(Input::get('currency'));
$interestPaymentType = trim(Input::get('interest_payment_type'));
$interestPaymentPercent = trim(Input::get('interest_payment_percent'));
if (!$depositAmount || !$term || !$currency) {
return Response::json(array('status' => false));
}
$calculator = new DepositCalculator();
$calculator->setDepositAmount($depositAmount);
$calculator->setTerm($term);
$calculator->setMonthlyInstallment($monthlyInstallment);
$calculator->setCurrency($currency);
$viewTemplate = 'partials.calculators.partials.deposit_table_main';
$sliderHtml = '';
if (!$isMain) {
$calculator->setInterestPaymentType($interestPaymentType);
$calculator->setInterestPaymentPercent($interestPaymentPercent);
$calculator->setIsMain(false);
$viewTemplate = 'partials.calculators.partials.deposit_table';
}
$calculations = $calculator->calculate();
if (!$isMain) {
$depositsIds = Tree::getDepositsCompared();
$depositsCatalog = Cache::tags('j_tree')->rememberForever('deposits_catalog_' . App::getLocale(), function () {
return Tree::find(Collector::get('idDepositsCatalog'));
});
$deposits = Cache::tags('j_tree')->rememberForever('deposits_products_' . App::getLocale(), function () use($depositsCatalog) {
return $depositsCatalog->children()->get();
});
$deposits = Tree::filterDepositsByIds($deposits, $depositsIds);
$allDeposits = Cache::tags('deposits')->rememberForever('deposits_' . App::getLocale(), function () {
return Deposit::all();
});
$depositOptionsGroups = Deposit::prepareData($allDeposits);
$sliderHtml = View::make('private-persons.deposits.partials.deposits_slider', compact('deposits', 'depositOptionsGroups', 'calculations'))->render();
}
$html = View::make($viewTemplate, compact('result', 'currency', 'calculations'))->render();
$firstDepositData = array();
if ($calculations) {
$firstDepositData = array_values($calculations)[0];
}
return Response::json(array('status' => true, 'html' => $html, 'slider_html' => $sliderHtml, 'currency' => isset($calculations['currency']) ? $calculations['currency'] : '', 'result' => isset($calculations['sum']) ? $calculations['sum'] : '', 'sum' => $firstDepositData['sum']));
}
示例2: __construct
public function __construct()
{
$this->settings = Collector::get('calculatorsSettings')['deposit'];
$this->setPercent($this->settings['percent']);
$this->setPercentMilitary($this->settings['percent_military']);
$this->setDepositIds(Tree::getDepositsCompared());
}
示例3: formDepositCompare
public function formDepositCompare()
{
$depositsIds = Tree::getDepositsCompared();
$html = '';
if ($depositsIds) {
$deposits = Tree::whereIn('id', $depositsIds)->active()->get();
$depositsEntities = Deposit::whereIn('id_tb_tree', $depositsIds)->get();
$depositsCompared = Deposit::prepareData($depositsEntities);
$html = View::make('partials.popups.deposits_compare_inner', compact('depositsCompared', 'deposits'))->render();
}
return Response::json(array('status' => true, 'html' => $html));
}