/**
  * @param CurrencyRepositoryInterface $repository
  * @param TransactionCurrency         $currency
  *
  * @return \Illuminate\Http\RedirectResponse
  * @throws \Exception
  */
 public function destroy(CurrencyRepositoryInterface $repository, TransactionCurrency $currency)
 {
     if ($repository->countJournals($currency) > 0) {
         Session::flash('error', 'Cannot destroy ' . e($currency->name) . ' because there are still transactions attached to it.');
         return redirect(route('currency.index'));
     }
     Session::flash('success', 'Currency "' . e($currency->name) . '" deleted');
     if (Auth::user()->hasRole('owner')) {
         $currency->delete();
     }
     return redirect(Session::get('currency.delete.url'));
 }
 /**
  * @param CurrencyRepositoryInterface $repository
  * @param TransactionCurrency         $currency
  *
  * @return \Illuminate\Http\RedirectResponse
  * @throws \Exception
  */
 public function destroy(CurrencyRepositoryInterface $repository, TransactionCurrency $currency)
 {
     if ($repository->countJournals($currency) > 0) {
         Session::flash('error', trans('firefly.cannot_delete_currency', ['name' => $currency->name]));
         return redirect(route('currency.index'));
     }
     Session::flash('success', trans('firefly.deleted_currency', ['name' => $currency->name]));
     if (Auth::user()->hasRole('owner')) {
         $currency->delete();
     }
     return redirect(Session::get('currency.delete.url'));
 }