PHP Classes

File: server/app/Transformers/TransactionsTransformer.php

Recommend this page to a friend!
  Classes of mohammad anzawi   PHP Wallet API and Application   server/app/Transformers/TransactionsTransformer.php   Download  
File: server/app/Transformers/TransactionsTransformer.php
Role: Class source
Content type: text/plain
Description: Class source
Class: PHP Wallet API and Application
Application to manage a wallet by calling an API
Author: By
Last change:
Date: 2 years ago
Size: 638 bytes
 

Contents

Class file image Download
<?php

namespace App\Transformers;

use
App\Models\Transaction;
use
League\Fractal\TransformerAbstract;

class
TransactionsTransformer extends TransformerAbstract
{
   
/**
     * A Fractal transformer.
     *
     * @return array
     */
   
public function transform(Transaction $transaction)
    {
        return [
           
'user' => $transaction->wallet->user->name?? 'blocked user' ,
           
'type' => $transaction->type,
           
'confirmed' => $transaction->confirmed,
           
'amount' => $transaction->amount,
           
'uuid' => $transaction->uuid,
           
'status' => $transaction->status
       
];
    }
}