Files
healthcareapi/app/Rules/EnsureArray.php
T
2026-06-08 19:58:50 +07:00

30 lines
636 B
PHP

<?php
namespace App\Rules;
use Closure;
use Illuminate\Contracts\Validation\ValidationRule;
class EnsureArray implements ValidationRule
{
/**
* Indicates whether the rule should be implicit.
*
* @var bool
*/
public $implicit = false;
/**
* Run the validation rule.
*
* @param \Closure(string): \Illuminate\Translation\PotentiallyTranslatedString $fail
*/
public function validate(string $attribute, mixed $value, Closure $fail): void
{
// print_r($value);
if (!is_array($value)) {
$fail("The :attribute must be an array.");
}
}
}