mirror of
				https://github.com/crater-invoice/crater.git
				synced 2025-11-04 06:23:17 -05:00 
			
		
		
		
	
		
			
				
	
	
		
			30 lines
		
	
	
		
			793 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
		
			793 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
 | 
						|
namespace Crater\Http\Resources\Customer;
 | 
						|
 | 
						|
use Illuminate\Http\Resources\Json\JsonResource;
 | 
						|
 | 
						|
class ExpenseCategoryResource extends JsonResource
 | 
						|
{
 | 
						|
    /**
 | 
						|
     * Transform the resource into an array.
 | 
						|
     *
 | 
						|
     * @param  \Illuminate\Http\Request  $request
 | 
						|
     * @return array
 | 
						|
     */
 | 
						|
    public function toArray($request)
 | 
						|
    {
 | 
						|
        return [
 | 
						|
            'id' => $this->id,
 | 
						|
            'name' => $this->name,
 | 
						|
            'description' => $this->description,
 | 
						|
            'company_id' => $this->company_id,
 | 
						|
            'amount' => $this->amount,
 | 
						|
            'formatted_created_at' => $this->formattedCreatedAt,
 | 
						|
            'company' => $this->when($this->company()->exists(), function () {
 | 
						|
                return new CompanyResource($this->company);
 | 
						|
            }),
 | 
						|
        ];
 | 
						|
    }
 | 
						|
}
 |