<?php

namespace App\Http\Controllers;

use App\Models\Pago;
use App\Models\Concepto;
use Illuminate\Routing\Controller;
use Illuminate\Support\Facades\Auth;

class PagoController extends Controller
{
//  public function __construct() {
//         $this->middleware('can:user.index')->only('index');
//     }
    public function index()
    {
        $user = Auth::user();

        $prospectoId = $user->prospectos()->value('prospectos.id');

        $pagos = Pago::where('user_id', $prospectoId)->get();

        $nombres = Concepto::where('tipo', '3')->get();

        return view('pago.index',compact('pagos','nombres'));
    }

}
