feat(ticketing): resolve validity in tenant timezone
This commit is contained in:
@@ -10,6 +10,11 @@ use Illuminate\Http\Resources\Json\JsonResource;
|
||||
/** @mixin ValidityTime */
|
||||
class ValidityTimeResource extends JsonResource
|
||||
{
|
||||
public function __construct($resource, private readonly string $timezone = 'UTC')
|
||||
{
|
||||
parent::__construct($resource);
|
||||
}
|
||||
|
||||
/** @return array<string, mixed> */
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
@@ -27,7 +32,7 @@ class ValidityTimeResource extends JsonResource
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'type' => $this->type->value,
|
||||
'is_valid' => $this->isValid(),
|
||||
'is_valid' => $this->isValid(timezone: $this->timezone),
|
||||
...array_filter($fields, fn (mixed $value): bool => $value !== null),
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user