update logic
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTOs\Order;
|
||||
|
||||
class ClientOrderFilters
|
||||
{
|
||||
public function __construct(
|
||||
public readonly ?string $totalPrice = null,
|
||||
public readonly bool $pending = false,
|
||||
) {
|
||||
}
|
||||
|
||||
public static function fromArray(array $data): self
|
||||
{
|
||||
return new self(
|
||||
totalPrice: $data['total_price'] ?? null,
|
||||
pending: filter_var($data['pending'] ?? false, FILTER_VALIDATE_BOOLEAN),
|
||||
);
|
||||
}
|
||||
|
||||
public function toArray(): array
|
||||
{
|
||||
return [
|
||||
'total_price' => $this->totalPrice,
|
||||
'pending' => $this->pending,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user