コード例 #1
0
 /**
  * @param BudgetRepositoryInterface $repository
  * @param Budget                    $budget
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function amount(BudgetRepositoryInterface $repository, Budget $budget)
 {
     $amount = intval(Input::get('amount'));
     $date = Session::get('start', Carbon::now()->startOfMonth());
     $limitRepetition = $repository->updateLimitAmount($budget, $date, $amount);
     if ($amount == 0) {
         $limitRepetition = null;
     }
     Preferences::mark();
     return Response::json(['name' => $budget->name, 'repetition' => $limitRepetition ? $limitRepetition->id : 0]);
 }
コード例 #2
0
 /**
  * @param BudgetRepositoryInterface $repository
  * @param Budget                    $budget
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function amount(BudgetRepositoryInterface $repository, Budget $budget)
 {
     $amount = intval(Input::get('amount'));
     /** @var Carbon $start */
     $start = session('start', Carbon::now()->startOfMonth());
     /** @var Carbon $end */
     $end = session('end', Carbon::now()->endOfMonth());
     $viewRange = Preferences::get('viewRange', '1M')->data;
     // is custom view range?
     if (session('is_custom_range') === true) {
         $viewRange = 'custom';
     }
     $limitRepetition = $repository->updateLimitAmount($budget, $start, $end, $viewRange, $amount);
     if ($amount == 0) {
         $limitRepetition = null;
     }
     Preferences::mark();
     return Response::json(['name' => $budget->name, 'repetition' => $limitRepetition ? $limitRepetition->id : 0]);
 }