This commit is contained in:
Laucha1312
2026-06-04 15:15:23 -03:00
parent 0841794c50
commit 90c5f85512
167 changed files with 15870 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
<?php
namespace App\AI\Tools;
use App\Models\Noticia;
class EliminarNoticiaTool
{
public function __invoke(int $id_noticia): string
{
try {
$noticia = Noticia::find($id_noticia);
if (!$noticia) {
return json_encode(['error' => "No se encontró la noticia con ID: {$id_noticia}"]);
}
$titulo = $noticia->titulo;
$noticia->delete();
return json_encode([
'success' => true,
'mensaje' => "Noticia \"{$titulo}\" (ID {$id_noticia}) eliminada correctamente.",
]);
} catch (\Throwable $e) {
return json_encode(['error' => 'No se pudo eliminar la noticia: ' . $e->getMessage()]);
}
}
}