Skip to content

Commit

Permalink
Create HasLimitParameterWithSmallerMax.php
Browse files Browse the repository at this point in the history
  • Loading branch information
irfan-dahir committed Nov 9, 2024
1 parent 41a3091 commit ff2c1c9
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions app/Dto/Concerns/HasLimitParameterWithSmallerMax.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace App\Dto\Concerns;

use App\Rules\Attributes\MaxLimitWithFallback;
use OpenApi\Annotations as OA;
use Spatie\LaravelData\Attributes\Validation\IntegerType;
use Spatie\LaravelData\Attributes\Validation\Min;
use Spatie\LaravelData\Optional;


/**
* @OA\Parameter(
* name="limit",
* in="query",
* @OA\Schema(type="integer")
* ),
*/
trait HasLimitParameterWithSmallerMax
{
use PreparesData;

#[IntegerType, Min(1), MaxLimitWithFallback(5)]
public int|Optional $limit;
}

0 comments on commit ff2c1c9

Please sign in to comment.