+ Update lastTransactions fields v2

This commit is contained in:
Djery-Tom 2020-06-03 13:55:51 +01:00
parent 8a8e9f5442
commit 71270c8e88
1 changed files with 2 additions and 1 deletions

View File

@ -12,6 +12,7 @@ use App\Models\WalletTransaction;
use App\Traits\ApiResponser; use App\Traits\ApiResponser;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Http\Response; use Illuminate\Http\Response;
use Illuminate\Support\Facades\DB;
class TransactionController extends Controller class TransactionController extends Controller
{ {
@ -153,7 +154,7 @@ class TransactionController extends Controller
public function lastTransactions($id_wallet){ public function lastTransactions($id_wallet){
$transactions = WalletTransaction::where('id_wallet',$id_wallet)->orderBy('date','desc')->limit(10) $transactions = WalletTransaction::where('id_wallet',$id_wallet)->orderBy('date','desc')->limit(10)
->get(['id', 'montant' ,'numCarte AS destinataire' ,'commission_ag', 'type' ,'date']); ->get(['type' ,DB::raw('\'wallet\' as source'), 'montant' ,'numCarte AS destinataire' , 'date', 'id']);
return $this->successResponse($transactions); return $this->successResponse($transactions);
} }