This commit is contained in:
James Cole 2015-12-26 08:06:34 +01:00
parent 9f7c6c2d0c
commit 170c1793cc
2 changed files with 10 additions and 9 deletions

View File

@ -49,7 +49,6 @@ class NewUserController extends Controller
*/
public function submit(NewUserFormRequest $request, AccountRepositoryInterface $repository)
{
// create normal asset account:
$assetAccount = [
'name' => $request->get('bank_name'),
@ -61,7 +60,7 @@ class NewUserController extends Controller
'accountRole' => 'defaultAsset',
'openingBalance' => round($request->input('bank_balance'), 2),
'openingBalanceDate' => new Carbon,
'openingBalanceCurrency' => intval($request->input('balance_currency_id')),
'openingBalanceCurrency' => intval($request->input('amount_currency_id_bank_balance')),
];
$repository->store($assetAccount);
@ -78,7 +77,7 @@ class NewUserController extends Controller
'accountRole' => 'savingAsset',
'openingBalance' => round($request->input('savings_balance'), 2),
'openingBalanceDate' => new Carbon,
'openingBalanceCurrency' => intval($request->input('balance_currency_id')),
'openingBalanceCurrency' => intval($request->input('amount_currency_id_savings_balance')),
];
$repository->store($savingsAccount);
}
@ -96,7 +95,7 @@ class NewUserController extends Controller
'accountRole' => 'ccAsset',
'openingBalance' => null,
'openingBalanceDate' => null,
'openingBalanceCurrency' => intval($request->input('balance_currency_id')),
'openingBalanceCurrency' => intval($request->input('amount_currency_id_credit_card_limit')),
];
$creditCard = $repository->store($creditAccount);

View File

@ -27,11 +27,13 @@ class NewUserFormRequest extends Request
public function rules()
{
return [
'bank_name' => 'required|between:1,200',
'bank_balance' => 'required|numeric',
'savings_balance' => 'numeric',
'credit_card_limit' => 'numeric',
'balance_currency_id' => 'exists:transaction_currencies,id',
'bank_name' => 'required|between:1,200',
'bank_balance' => 'required|numeric',
'savings_balance' => 'numeric',
'credit_card_limit' => 'numeric',
'amount_currency_id_bank_balance' => 'exists:transaction_currencies,id',
'amount_currency_id_savings_balance' => 'exists:transaction_currencies,id',
'amount_currency_id_credit_card_limit' => 'exists:transaction_currencies,id',
];
}
}