archivo de configuracion de nginx agregado para el puerto 9000

This commit is contained in:
2026-05-02 16:57:29 -06:00
parent 2af36ea272
commit 881e67fb12
33 changed files with 2035 additions and 245 deletions
@@ -0,0 +1,80 @@
<?php
namespace App\Http\Controllers;
use App\Models\Alumno;
use App\Models\Entrega;
use App\Models\Tarea;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
use Illuminate\Support\Facades\Auth;
class EntregaController extends Controller
{
public function index()
{
$alumno = Alumno::whereHas('alumnos', fn($q) => $q->where('id', Auth::id()))->first();
if (!$alumno) {
return view('tarea.mis_tareas', ['tareas' => collect(), 'entregasMap' => collect()]);
}
$gruposIds = $alumno->grupos()->pluck('grupos.id');
$tareas = Tarea::whereIn('grupo_id', $gruposIds)
->with(['material', 'grupo'])
->orderByDesc('created_at')
->get();
$entregasMap = Entrega::where('alumno_id', $alumno->id)
->whereIn('tarea_id', $tareas->pluck('id'))
->get()
->keyBy('tarea_id');
return view('tarea.mis_tareas', compact('tareas', 'entregasMap', 'alumno'));
}
public function store(Request $request, Tarea $tarea)
{
$request->validate([
'archivo' => 'nullable|file|max:20480',
'texto' => 'nullable|string|max:5000',
]);
if (!$request->hasFile('archivo') && !filled($request->texto)) {
return back()->withErrors(['entrega' => 'Debes escribir un texto o adjuntar un archivo.']);
}
$alumno = Alumno::whereHas('alumnos', fn($q) => $q->where('id', Auth::id()))->firstOrFail();
$entrega = Entrega::where('tarea_id', $tarea->id)
->where('alumno_id', $alumno->id)
->first();
if (!$entrega) {
$entrega = Entrega::create([
'tarea_id' => $tarea->id,
'alumno_id' => $alumno->id,
'status' => 'sin_subir',
]);
}
if ($entrega->status !== 'sin_subir') {
return back()->with('error', 'Ya entregaste esta tarea y no puedes volver a subirla.');
}
$path = null;
if ($request->hasFile('archivo')) {
// Almacena en disco local (privado) igual que el FileController espera
$path = $request->file('archivo')->store("entregas/{$tarea->id}");
}
$entrega->update([
'archivo' => $path,
'texto' => $request->texto,
'status' => 'pendiente',
]);
return back()->with('info', 'Tarea enviada correctamente. Queda pendiente de calificación.');
}
}