public function getDepositInterest() { App::setLocale(Cookie::get('locale', 'ru')); $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')); if (!$depositAmount || !$term || !$currency) { return Response::json(array('status' => false)); } if (!in_array($term, array(1, 2, 3, 4, 5, 6, 7, 12))) { $term = 0; } $filteredDepositEntities = Deposit::amount($depositAmount)->terms(array(0, $term))->monthly($monthlyInstallment)->currency($currency)->get(); $filteredDepositEntitiesIds = array(); foreach ($filteredDepositEntities as $filteredDepositEntity) { $filteredDepositEntitiesIds[] = $filteredDepositEntity->id_tb_tree; } Tree::setDepositsCompared($filteredDepositEntitiesIds); $maxPercents = Deposit::prepareMaxPercents($filteredDepositEntities); $html = View::make('private-persons.deposits.partials.redemptions', compact('maxPercents'))->render(); return Response::json(array('status' => true, 'html' => $html, 'max_percent' => $maxPercents['max_percent'], 'max_percent_type' => $maxPercents['max_percent_type'])); }