initial commit
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
<?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.");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user