Make sure create uses the right fields.

This commit is contained in:
James Cole
2020-03-14 07:49:11 +01:00
parent bde0732135
commit fdffed636f
5 changed files with 11 additions and 9 deletions

View File

@@ -71,8 +71,8 @@ class CreateController extends Controller
{
$hasOldInput = null !== $request->old('_token');
// auto budget options
$autoBudgetOptions = [
// auto budget types
$autoBudgetTypes = [
0 => (string)trans('firefly.auto_budget_none'),
AutoBudget::AUTO_BUDGET_RESET => (string)trans('firefly.auto_budget_reset'),
AutoBudget::AUTO_BUDGET_ROLLOVER => (string)trans('firefly.auto_budget_rollover'),
@@ -101,7 +101,7 @@ class CreateController extends Controller
$request->session()->forget('budgets.create.fromStore');
$subTitle = (string)trans('firefly.create_new_budget');
return view('budgets.create', compact('subTitle', 'autoBudgetOptions', 'autoBudgetPeriods'));
return view('budgets.create', compact('subTitle', 'autoBudgetTypes', 'autoBudgetPeriods'));
}

View File

@@ -50,7 +50,7 @@ class BudgetFormStoreRequest extends Request
return [
'name' => $this->string('name'),
'active' => $this->boolean('active'),
'auto_budget_type' => $this->integer('auto_budget_type'),
'auto_budget_type' => $this->integer('auto_budget_type'),
'transaction_currency_id' => $this->integer('transaction_currency_id'),
'auto_budget_amount' => $this->string('auto_budget_amount'),
'auto_budget_period' => $this->string('auto_budget_period'),
@@ -67,8 +67,8 @@ class BudgetFormStoreRequest extends Request
return [
'name' => 'required|between:1,100|uniqueObjectForUser:budgets,name',
'active' => 'numeric|between:0,1',
'auto_budget_option' => 'numeric|between:0,2',
'transaction_currency_id' => 'required|exists:transaction_currencies,id',
'auto_budget_type' => 'numeric|between:0,2',
'auto_budget_currency_id' => 'required|exists:transaction_currencies,id',
'auto_budget_amount' => 'min:0|max:1000000000',
'auto_budget_period' => 'in:daily,weekly,monthly,quarterly,half_year,yearly',
];