/**
  *
  * @param CurrencyFormRequest         $request
  * @param CurrencyRepositoryInterface $repository
  *
  * @return $this|\Illuminate\Http\RedirectResponse
  */
 public function store(CurrencyFormRequest $request, CurrencyRepositoryInterface $repository)
 {
     $data = $request->getCurrencyData();
     if (Auth::user()->hasRole('owner')) {
         $currency = $repository->store($data);
         Session::flash('success', 'Currency "' . $currency->name . '" created');
     }
     if (intval(Input::get('create_another')) === 1) {
         Session::put('currency.create.fromStore', true);
         return redirect(route('currency.create'))->withInput();
     }
     // redirect to previous URL.
     return redirect(Session::get('currency.create.url'));
 }
 /**
  *
  * @param CurrencyFormRequest         $request
  * @param CurrencyRepositoryInterface $repository
  *
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function store(CurrencyFormRequest $request, CurrencyRepositoryInterface $repository)
 {
     if (!auth()->user()->hasRole('owner')) {
         Log::error('User ' . auth()->user()->id . ' is not admin, but tried to store a currency.');
         return redirect(session('currency.create.url'));
     }
     $data = $request->getCurrencyData();
     $currency = $repository->store($data);
     Session::flash('success', trans('firefly.created_currency', ['name' => $currency->name]));
     if (intval(Input::get('create_another')) === 1) {
         Session::put('currency.create.fromStore', true);
         return redirect(route('currency.create'))->withInput();
     }
     // redirect to previous URL.
     return redirect(session('currency.create.url'));
 }