first commit
This commit is contained in:
		
							
								
								
									
										32
									
								
								app/Http/Transformers/Banking/Account.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								app/Http/Transformers/Banking/Account.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,32 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace App\Http\Transformers\Banking;
 | 
			
		||||
 | 
			
		||||
use App\Models\Banking\Account as Model;
 | 
			
		||||
use League\Fractal\TransformerAbstract;
 | 
			
		||||
 | 
			
		||||
class Account extends TransformerAbstract
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * @param Model $model
 | 
			
		||||
     * @return array
 | 
			
		||||
     */
 | 
			
		||||
    public function transform(Model $model)
 | 
			
		||||
    {
 | 
			
		||||
        return [
 | 
			
		||||
            'id' => $model->id,
 | 
			
		||||
            'company_id' => $model->company_id,
 | 
			
		||||
            'name' => $model->name,
 | 
			
		||||
            'number' => $model->number,
 | 
			
		||||
            'currency_code' => $model->currency_code,
 | 
			
		||||
            'opening_balance' => $model->opening_balance,
 | 
			
		||||
            'current_balance' => $model->balance,
 | 
			
		||||
            'bank_name' => $model->bank_name,
 | 
			
		||||
            'bank_phone' => $model->bank_phone,
 | 
			
		||||
            'bank_address' => $model->bank_address,
 | 
			
		||||
            'enabled' => $model->enabled,
 | 
			
		||||
            'created_at' => $model->created_at->toIso8601String(),
 | 
			
		||||
            'updated_at' => $model->updated_at->toIso8601String(),
 | 
			
		||||
        ];
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										50
									
								
								app/Http/Transformers/Banking/Transfer.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								app/Http/Transformers/Banking/Transfer.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,50 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace App\Http\Transformers\Banking;
 | 
			
		||||
 | 
			
		||||
use App\Http\Transformers\Expense\Payment;
 | 
			
		||||
use App\Http\Transformers\Income\Revenue;
 | 
			
		||||
use App\Models\Banking\Transfer as Model;
 | 
			
		||||
use League\Fractal\TransformerAbstract;
 | 
			
		||||
 | 
			
		||||
class Transfer extends TransformerAbstract
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * @var array
 | 
			
		||||
     */
 | 
			
		||||
    protected $defaultIncludes = ['payment', 'revenue'];
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param Model $model
 | 
			
		||||
     * @return array
 | 
			
		||||
     */
 | 
			
		||||
    public function transform(Model $model)
 | 
			
		||||
    {
 | 
			
		||||
        return [
 | 
			
		||||
            'id' => $model->id,
 | 
			
		||||
            'company_id' => $model->company_id,
 | 
			
		||||
            'payment_id' => $model->payment_id,
 | 
			
		||||
            'revenue_id' => $model->revenue_id,
 | 
			
		||||
            'created_at' => $model->created_at->toIso8601String(),
 | 
			
		||||
            'updated_at' => $model->updated_at->toIso8601String(),
 | 
			
		||||
        ];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param Model $model
 | 
			
		||||
     * @return \League\Fractal\Resource\Item
 | 
			
		||||
     */
 | 
			
		||||
    public function includePayment(Model $model)
 | 
			
		||||
    {
 | 
			
		||||
        return $this->item($model->payment, new Payment());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param Model $model
 | 
			
		||||
     * @return \League\Fractal\Resource\Item
 | 
			
		||||
     */
 | 
			
		||||
    public function includeRevenue(Model $model)
 | 
			
		||||
    {
 | 
			
		||||
        return $this->item($model->revenue, new Revenue());
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user