PHP Classes

File: server/app/Transformers/PaymentTransformer.php

Recommend this page to a friend!
  Classes of mohammad anzawi   PHP Wallet API and Application   server/app/Transformers/PaymentTransformer.php   Download  
File: server/app/Transformers/PaymentTransformer.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: 1,080 bytes
 

Contents

Class file image Download
<?php

namespace App\Transformers;

use
App\Models\Payment;
use
Illuminate\Support\Facades\Storage;
use
Illuminate\Support\Str;
use
League\Fractal\TransformerAbstract;

class
PaymentTransformer extends TransformerAbstract
{
   
/**
     * List of resources possible to include
     *
     * @var array
     */
   
protected $availableIncludes = [
       
//
   
];

   
/**
     * A Fractal transformer.
     *
     * @return array
     */
   
public function transform(Payment $payment)
    {
        return [
           
'name' => $payment->name,
           
'currencies' => is_array($payment->currencies) ? json_encode($payment->currencies) : $payment->currencies,
           
'deposit' => [
               
'min' => $payment->min_deposit,
               
'max' => $payment->max_deposit
           
],
           
'withdrawal' => [
               
'min' => $payment->min_withdrawal,
               
'max' => $payment->max_withdrawal
           
],
           
'img' => url("/storage/images/$payment->img/$payment->img"),
           
'slug' => $payment->slug
       
];
    }
}