2026-06-14 21:32:07 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Requests\Bo\Ranges;
|
|
|
|
|
|
2026-10-01 11:25:05 +02:00
|
|
|
use App\Actions\Ranges\UpdateRangeInput;
|
|
|
|
|
use App\Models\Range;
|
|
|
|
|
use Domain\Models\ValueObjects\PictureMetadata;
|
|
|
|
|
|
2026-06-14 21:32:07 +02:00
|
|
|
class UpdateRangeRequest extends StoreRangeRequest
|
|
|
|
|
{
|
2026-10-01 11:25:05 +02:00
|
|
|
public function toUpdateRangeInput(Range $range): UpdateRangeInput
|
|
|
|
|
{
|
|
|
|
|
$pictureAlt = $this->filled('picture_alt') ? $this->string('picture_alt')->value() : null;
|
|
|
|
|
$pictureTitle = $this->filled('picture_title') ? $this->string('picture_title')->value() : null;
|
|
|
|
|
|
|
|
|
|
return new UpdateRangeInput(
|
|
|
|
|
range: $range,
|
|
|
|
|
name: $this->string('name')->value(),
|
|
|
|
|
description: $this->filled('description') ? $this->string('description')->value() : null,
|
|
|
|
|
picture: $this->file('picture'),
|
|
|
|
|
pictureMetadata: new PictureMetadata(
|
|
|
|
|
alt: $pictureAlt,
|
|
|
|
|
title: $pictureTitle,
|
|
|
|
|
),
|
|
|
|
|
status: $this->boolean('status'),
|
|
|
|
|
);
|
|
|
|
|
}
|
2026-06-14 21:32:07 +02:00
|
|
|
}
|