Skip to content

Commit

Permalink
all test cases passed✅
Browse files Browse the repository at this point in the history
  • Loading branch information
Sudeep-K committed Jan 25, 2024
1 parent 8d16fef commit 5cbca08
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions app/Rules/Uppercase.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

namespace App\Rules;

use Closure;
use Illuminate\Contracts\Validation\ValidationRule;

class Uppercase implements ValidationRule
{
/**
* Run the validation rule.
*
* @param \Closure(string): \Illuminate\Translation\PotentiallyTranslatedString $fail
*/
public function validate(string $attribute, mixed $value, Closure $fail): void
{
if (strtoupper($value[0]) != $value[0]) {
$fail("The :attribute does not start with an uppercased letter");
}
}
}

0 comments on commit 5cbca08

Please sign in to comment.