You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
763 B
32 lines
763 B
4 weeks ago
|
<?php
|
||
|
|
||
|
namespace App\Http\Resources\Dictionary;
|
||
|
|
||
|
use Illuminate\Http\Request;
|
||
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||
|
|
||
|
class ItemDetailsResource extends JsonResource
|
||
|
{
|
||
|
/**
|
||
|
* Transform the resource into an array.
|
||
|
*
|
||
|
* @return array<string, mixed>
|
||
|
*/
|
||
|
public function toArray(Request $request = null): array
|
||
|
{
|
||
|
$lists = [];
|
||
|
foreach ($this->resource['ITEM'] as $v) {
|
||
|
$lists[] = [
|
||
|
'type_name' => $v['TYPENAME'],
|
||
|
'item_name' => $v['COSTNAME'],
|
||
|
'unit' => $v['UNIT'],
|
||
|
'spec' => $v['COSTSPEC'],
|
||
|
'price' => $v['PRICE'],
|
||
|
'cd_name' => $v['CDNAME'] ?? '',
|
||
|
];
|
||
|
}
|
||
|
|
||
|
return $lists;
|
||
|
}
|
||
|
}
|