<?php

namespace App\Http\Controllers;

use App\Models\Payment;
use Illuminate\Http\Request;

class ClientInvoicesController extends Controller
{
    public function invoices()
    {
        $payments = Payment::with('project', 'user')
        ->where('user_id', auth()->id())
        ->orderBy('created_at', 'desc')->paginate(20);
        
        return view('dashboard.invoices', compact('payments'));
    }

    public function show($id)
    {
        $payment = Payment::with('project', 'user')->where('user_id', auth()->id())->findOrFail($id);
        return view('dashboard.invoice_details', compact('payment'));
    }
}
