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.
31 lines
763 B
31 lines
763 B
<?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;
|
|
}
|
|
}
|
|
|