Refactored the codebase to change the namespaces of various actions and queries from `App\Actions` to `App\Cqs\Actions` and `App\Queries` to `App\Cqs\Queries`. This restructuring improves organization and clarity in the codebase.
30 lines
989 B
PHP
30 lines
989 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Http\Requests\Bo\Ranges;
|
|
|
|
use App\Cqs\Actions\Ranges\UpdateRangeInput;
|
|
use App\Models\Range;
|
|
use Domain\Models\ValueObjects\PictureMetadata;
|
|
|
|
class UpdateRangeRequest extends StoreRangeRequest
|
|
{
|
|
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'),
|
|
);
|
|
}
|
|
}
|