ldc-legaulois/app/Http/Resources/XmlIncoCollection.php
2021-04-16 10:24:05 +02:00

34 lines
797 B
PHP

<?php
namespace App\Http\Resources;
use App\Models\XmlInco;
use Illuminate\Http\Resources\Json\ResourceCollection;
class XmlIncoCollection extends ResourceCollection
{
/**
* The resource that this resource collects.
*
* @var string
*/
public $collects = XmlInco::class;
/**
* Transform the resource collection into an array.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
// @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
public function toArray($request)
{
return $this->collection->map(function ($xmlInco) {
return [
'label' => $xmlInco->nice_string,
'value' => $xmlInco->id
];
})->all();
}
}