You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.3 KiB
47 lines
1.3 KiB
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use Illuminate\Http\Request;
|
|
use App\Models\Prestamo;
|
|
|
|
class UserDashboardController extends Controller
|
|
{
|
|
public function __construct()
|
|
{
|
|
$this->middleware('auth');
|
|
}
|
|
|
|
public function index()
|
|
{
|
|
// Permitir acceso solo a tipo 2 (Usuario normal)
|
|
if (auth()->user()->tipos_id != 2) {
|
|
return redirect('/')->with('error', 'No tienes permiso para acceder a esta sección');
|
|
}
|
|
|
|
return view('user-dashboard.index');
|
|
}
|
|
|
|
public function prestamosAceptados()
|
|
{
|
|
// Mostrar todos los préstamos aceptados a cualquier usuario tipo 2
|
|
$prestamos = Prestamo::where('estado', 'aceptado')->with('choferAsignado')->get();
|
|
|
|
return view('user-dashboard.prestamos-aceptados', compact('prestamos'));
|
|
}
|
|
|
|
public function detallePrestamo($id)
|
|
{
|
|
$prestamo = Prestamo::findOrFail($id);
|
|
return view('user-dashboard.detalle-prestamo', compact('prestamo'));
|
|
}
|
|
|
|
public function cuestionario(Request $request)
|
|
{
|
|
$prestamo = null;
|
|
if ($request->has('prestamo_id')) {
|
|
$prestamo = \App\Models\Prestamo::find($request->prestamo_id);
|
|
}
|
|
return view('user-dashboard.cuestionario', compact('prestamo'));
|
|
}
|
|
}
|
|
|