/**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(CreateTransactionRequest $request, $accountId)
 {
     $account = Bank_account::find($accountId);
     if (!$account) {
         return response()->json(['message' => 'This account does not exist', 'code' => 404], 404);
     }
     $values = $request->all();
     $values['acc_currencyid'] = $account['currency_id'];
     // return $values;
     $account->activities()->create($values);
     return response()->json(['message' => 'The transaction was accepted'], 201);
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(CreateTransactionRequest $request, $id)
 {
     $transaction = Transaction::findOrFail($id);
     $transaction->update($request->all());
     return redirect('transactions');
 }
 /**
  * Store new transaction
  *
  * @param CreateTransactionRequest $request
  *
  * @return AccountsHistory
  */
 public static function storeNewTransaction(CreateTransactionRequest $request)
 {
     return AccountsHistory::create(self::checkTransactionType($request->all()));
 }