Skip to content

Instantly share code, notes, and snippets.

@codigoconjuan
Created August 24, 2022 18:54
Show Gist options
  • Select an option

  • Save codigoconjuan/5953a70f9ddf5722fa97f1991aaf07c2 to your computer and use it in GitHub Desktop.

Select an option

Save codigoconjuan/5953a70f9ddf5722fa97f1991aaf07c2 to your computer and use it in GitHub Desktop.
Validación para Nuevos Eventos
// Mensajes de validación para la creación de un evento
public function validar() {
if(!$this->nombre) {
self::$alertas['error'][] = 'El Nombre es Obligatorio';
}
if(!$this->descripcion) {
self::$alertas['error'][] = 'La descripción es Obligatoria';
}
if(!$this->categoria_id || !filter_var($this->categoria_id, FILTER_VALIDATE_INT)) {
self::$alertas['error'][] = 'Elige una Categoría';
}
if(!$this->dia_id || !filter_var($this->dia_id, FILTER_VALIDATE_INT)) {
self::$alertas['error'][] = 'Elige el Día del evento';
}
if(!$this->hora_id || !filter_var($this->hora_id, FILTER_VALIDATE_INT)) {
self::$alertas['error'][] = 'Elige la hora del evento';
}
if(!$this->disponibles || !filter_var($this->disponibles, FILTER_VALIDATE_INT)) {
self::$alertas['error'][] = 'Añade una cantidad de Lugares Disponibles';
}
if(!$this->ponente_id || !filter_var($this->ponente_id, FILTER_VALIDATE_INT) ) {
self::$alertas['error'][] = 'Selecciona la persona encargada del evento';
}
return self::$alertas;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment