mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-19 08:32:14 +00:00
Resource refactoring
This commit is contained in:
32
app/Http/Resources/Oasis/OasisViewInvoiceResource.php
Normal file
32
app/Http/Resources/Oasis/OasisViewInvoiceResource.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Oasis;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class OasisViewInvoiceResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'client_id' => $this->client_id,
|
||||
'name' => $this->client['name'] . ' ' . format_to_currency($this->total_net, $this->currency),
|
||||
'invoiceNumber' => $this->invoice_number,
|
||||
'total' => format_to_currency($this->total_net, $this->currency),
|
||||
'file_url' => "/oasis/invoice/$this->id",
|
||||
'clientName' => $this->client['name'],
|
||||
'mimetype' => 'pdf',
|
||||
'type' => 'invoice',
|
||||
'created_at' => format_date($this->created_at, '%d. %B. %Y'),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user