mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-09-07 15:44:10 +00:00
chore(purchases): remove legacy-era purchases sources
This commit is contained in:
@@ -1,67 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Purchases\Http\Resources;
|
||||
|
||||
use App\Domains\Accounts\Http\Resources\CompanyResource;
|
||||
use App\Domains\Accounts\Http\Resources\UserResource;
|
||||
use App\Domains\Contacts\Http\Resources\CustomerResource;
|
||||
use App\Domains\Metadata\Http\Resources\CustomFieldValueResource;
|
||||
use App\Domains\Money\Http\Resources\CurrencyResource;
|
||||
use App\Domains\Receivables\Http\Resources\PaymentMethodResource;
|
||||
use App\Domains\Taxation\Http\Resources\TaxResource;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class ExpenseResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param Request $request
|
||||
*/
|
||||
public function toArray($request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'expense_date' => $this->expense_date,
|
||||
'expense_number' => $this->expense_number,
|
||||
'amount' => $this->amount,
|
||||
'notes' => $this->notes,
|
||||
'customer_id' => $this->customer_id,
|
||||
'attachment_receipt_url' => $this->receipt_url,
|
||||
'attachment_receipt' => $this->receipt,
|
||||
'attachment_receipt_meta' => $this->receipt_meta,
|
||||
'company_id' => $this->company_id,
|
||||
'expense_category_id' => $this->expense_category_id,
|
||||
'creator_id' => $this->creator_id,
|
||||
'formatted_expense_date' => $this->formattedExpenseDate,
|
||||
'formatted_created_at' => $this->formattedCreatedAt,
|
||||
'exchange_rate' => $this->exchange_rate,
|
||||
'currency_id' => $this->currency_id,
|
||||
'base_amount' => $this->base_amount,
|
||||
'payment_method_id' => $this->payment_method_id,
|
||||
'taxes' => TaxResource::collection($this->whenLoaded('taxes')),
|
||||
'customer' => $this->when($this->customer()->exists(), function () {
|
||||
return new CustomerResource($this->customer);
|
||||
}),
|
||||
'expense_category' => $this->when($this->category()->exists(), function () {
|
||||
return new ExpenseCategoryResource($this->category);
|
||||
}),
|
||||
'creator' => $this->when($this->creator()->exists(), function () {
|
||||
return new UserResource($this->creator);
|
||||
}),
|
||||
'fields' => $this->when($this->fields()->exists(), function () {
|
||||
return CustomFieldValueResource::collection($this->fields);
|
||||
}),
|
||||
'company' => $this->when($this->company()->exists(), function () {
|
||||
return new CompanyResource($this->company);
|
||||
}),
|
||||
'currency' => $this->when($this->currency()->exists(), function () {
|
||||
return new CurrencyResource($this->currency);
|
||||
}),
|
||||
'payment_method' => $this->when($this->paymentMethod()->exists(), function () {
|
||||
return new PaymentMethodResource($this->paymentMethod);
|
||||
}),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user