Пример #1
0
 public function getAccountStatistics()
 {
     $account_statistics = array();
     $transactions = Transaction::all();
     $account_statistics['total'] = $transactions->where('type', 'cashback')->sum('amount');
     $account_statistics['confirmed'] = $transactions->where('type', 'cashback')->where('status', 'Confirmed')->sum('amount');
     $account_statistics['pending'] = $transactions->where('type', 'cashback')->where('status', 'Pending')->sum('amount');
     $account_statistics['paid'] = $transactions->where('type', 'payment')->sum('amount');
     $account_statistics['balance'] = $account_statistics['confirmed'] - $account_statistics['paid'];
     return $account_statistics;
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     Transaction::destroy($id);
     \Session::flash('status', 'The transaction has been deleted successfully.');
     return redirect('admin/transactions');
 }