Redirect when 0 accounts.

Signed-off-by: James Cole <thegrumpydictator@gmail.com>
This commit is contained in:
James Cole
2016-11-02 21:24:16 +01:00
parent a7e0e3fc15
commit e1be4909b9
2 changed files with 10 additions and 6 deletions

View File

@@ -107,6 +107,12 @@ class PiggyBankController extends Controller
$subTitle = trans('firefly.new_piggy_bank');
$subTitleIcon = 'fa-plus';
if (count($accounts) === 0) {
Session::flash('error', strval(trans('firefly.need_at_least_one_account')));
return redirect(route('new-user.index'));
}
// put previous url in session if not redirect from store (not "create another").
if (session('piggy-banks.create.fromStore') !== true) {
Session::put('piggy-banks.create.url', URL::previous());