Laravel 11, Vuexy Admin 10.3, by admin@koneko.mx
This commit is contained in:
20
modules/Admin/App/Rules/NotEmptyHtml.php
Normal file
20
modules/Admin/App/Rules/NotEmptyHtml.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\App\Rules;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
|
||||
class NotEmptyHtml implements ValidationRule
|
||||
{
|
||||
public function validate(string $attribute, mixed $value, Closure $fail): void
|
||||
{
|
||||
// Eliminar etiquetas HTML y espacios en blanco
|
||||
$strippedContent = trim(strip_tags($value));
|
||||
|
||||
// Considerar vacío si no queda contenido significativo
|
||||
if (empty($strippedContent)) {
|
||||
$fail('El contenido no puede estar vacío.');
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user