File "TrimmedEnum.php"
Full Path: /home/trinadezambia/public_html/admin_panel/app/Rules/TrimmedEnum.php
File size: 492 bytes
MIME-type: text/x-php
Charset: utf-8
<?php
namespace App\Rules;
use Closure;
use Illuminate\Contracts\Validation\Rule;
class TrimmedEnum implements Rule
{
protected $values;
public function __construct(array $values)
{
$this->values = $values;
}
public function passes($attribute, $value)
{
$value = trim($value); // Trim the value
return in_array($value, $this->values);
}
public function message()
{
return 'The :attribute field is not valid.';
}
}