public static function boot() { parent::boot(); static::deleting(function ($novedad) { TagCtrl::updateTags($evento->contenido, array()); foreach ($novedad->comentarios as $comentario) { $comentario->delete(); } $novedad->contenido->delete(); return true; }); }
public static function boot() { parent::boot(); static::deleting(function ($problemat) { TagCtrl::updateTags($problemat->contenido, array()); foreach ($problemat->comentarios as $comentario) { $comentario->delete(); } $problemat->votos()->delete(); $problemat->contenido->delete(); return true; }); }
public static function boot() { parent::boot(); static::deleting(function ($documento) { TagCtrl::updateTags($evento->contenido, array()); foreach ($documento->parrafos as $parrafo) { $CommentIds = $parrafo->comentarios()->lists('id'); if ($CommentIds) { $AnswerIds = Comentario::where('comentable_type', 'Comentario')->whereIn('comentable_id', $CommentIds)->lists('id'); if ($AnswerIds) { VotoComentario::whereIn('comentario_id', $AnswerIds)->delete(); Comentario::whereIn('id', $AnswerIds)->delete(); } VotoComentario::whereIn('comentario_id', $CommentIds)->delete(); $parrafo->comentarios()->delete(); } $parrafo->delete(); } $documento->versiones()->delete(); $documento->contenido->delete(); return true; }); }