Skip to content

Commit

Permalink
Create Uppercase.php
Browse files Browse the repository at this point in the history
  • Loading branch information
OhmygoodR authored May 11, 2024
1 parent 859b368 commit 9b1c135
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions app/Rules/Uppercase.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace App\Rules;

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

class Uppercase implements ValidationRule
{
/**
* Run the validation rule.
*/
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 9b1c135

Please sign in to comment.