mirror of
https://gh.wpcy.net/https://github.com/fairpm/aspirecloud.git
synced 2026-06-20 02:22:28 +08:00
27 lines
690 B
PHP
27 lines
690 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Values\Packages;
|
|
|
|
use App\Values\DTO;
|
|
use Bag\Attributes\StripExtraParameters;
|
|
use Bag\Attributes\Transforms;
|
|
use Illuminate\Http\Request;
|
|
|
|
#[StripExtraParameters]
|
|
readonly class PackageInformationRequest extends DTO
|
|
{
|
|
public const ACTION = 'package_information';
|
|
|
|
public function __construct(
|
|
public string $did,
|
|
) {}
|
|
|
|
/** @return array<string, mixed> */
|
|
#[Transforms(Request::class)]
|
|
public static function fromRequest(Request $request): array
|
|
{
|
|
// Bag throws 500 (RuntimeException) for missing fields, this throws a friendlier 422
|
|
return $request->validate(['did' => 'required']);
|
|
}
|
|
}
|