renew and other crud functionality

This commit is contained in:
2026-01-11 18:31:03 +00:00
parent 55bf184d53
commit ca516d74c2
21 changed files with 882 additions and 74 deletions

View File

@@ -6,14 +6,19 @@ use Inertia\Inertia;
class PaymentController extends Controller
{
public function index(Request $request)
{
$payments = Payment::with('contract.unit.building', 'contract.person')
->when($request->status, fn($q) => $q->where('status', $request->status))
->when($request->type, fn($q) => $q->where('payment_type', $request->type))
->latest()
->paginate(20);
public function index(Request $request)
{
$payments = Payment::with('contract.unit.building', 'contract.person')
->when($request->search, fn($q) =>
$q->whereHas('contract', fn($q2) =>
$q2->where('contract_number', 'like', "%{$request->search}%")
)
)
->when($request->status, fn($q) => $q->where('status', $request->status))
->when($request->type, fn($q) => $q->where('payment_type', $request->type))
->latest()
->paginate(20);
return Inertia::render('Payments/Index', ['payments' => $payments]);
}
return Inertia::render('Payments/Index', ['payments' => $payments]);
}
}