20 lines
445 B
PHP
20 lines
445 B
PHP
<?php
|
|
|
|
namespace App\Services\Parents;
|
|
|
|
use App\Models\Invoice;
|
|
|
|
class ParentInvoiceService
|
|
{
|
|
public function listInvoices(int $parentId, ?string $schoolYear = null): array
|
|
{
|
|
$rows = Invoice::query()
|
|
->where('parent_id', $parentId)
|
|
->when($schoolYear, fn ($q) => $q->where('school_year', $schoolYear))
|
|
->orderByDesc('created_at')
|
|
->get();
|
|
|
|
return $rows->toArray();
|
|
}
|
|
}
|