2023-03-24 16:09:27 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
|
|
|
|
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
|
|
2026-02-12 16:09:21 +01:00
|
|
|
/**
|
|
|
|
|
* @mixin \App\Models\Url
|
|
|
|
|
*/
|
2023-03-24 16:09:27 +00:00
|
|
|
class UrlResource extends JsonResource
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* Transform the resource into an array.
|
|
|
|
|
*
|
|
|
|
|
* @param \Illuminate\Http\Request $request
|
|
|
|
|
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
|
2023-11-23 15:33:07 +01:00
|
|
|
*
|
|
|
|
|
* @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass, Squiz.Commenting.FunctionComment.TypeHintMissing
|
2023-03-24 16:09:27 +00:00
|
|
|
*/
|
|
|
|
|
public function toArray($request)
|
|
|
|
|
{
|
|
|
|
|
return [
|
|
|
|
|
'id' => $this->id,
|
|
|
|
|
'key' => $this->key,
|
|
|
|
|
'value' => $this->value,
|
|
|
|
|
'brand' => new BrandResource($this->brand)
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|