29 lines
801 B
PHP
29 lines
801 B
PHP
<?php
|
|
|
|
namespace App\Http\Resources\Api\Admin;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class CustomerResource extends JsonResource
|
|
{
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'fullname' => $this->fullname,
|
|
'email' => $this->email,
|
|
'phone' => $this->phone,
|
|
'company' => $this->company,
|
|
'status' => match ((int) $this->status) {
|
|
1 => 'active',
|
|
2 => 'inactive',
|
|
3 => 'suspended',
|
|
default => 'pending',
|
|
},
|
|
'total' => (int) $this->total,
|
|
'created_at' => $this->created_at,
|
|
];
|
|
}
|
|
}
|