update project

This commit is contained in:
root
2026-05-30 01:11:35 -04:00
parent 3a0628ecc7
commit 2225f6bc72
9743 changed files with 1122482 additions and 59 deletions
@@ -0,0 +1,44 @@
<?php
declare(strict_types=1);
namespace App\Domain\SchoolCore\Payments;
use App\Domain\SchoolCore\Context\SchoolContext;
use App\Models\Payment;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
use Symfony\Component\HttpFoundation\StreamedResponse;
final class PaymentFileController
{
public function show(Request $request, int $payment, int $file): StreamedResponse
{
/** @var SchoolContext $context */
$context = $request->attributes->get(SchoolContext::class);
$paymentRecord = Payment::query()
->whereKey($payment)
->where('school_id', $context->schoolId)
->with('files')
->firstOrFail();
if (method_exists($request->user(), 'can') && ! $request->user()->can('viewFile', [$paymentRecord, $context])) {
Log::warning('Payment file access denied.', $context->auditPayload() + [
'payment_id' => $payment,
'file_id' => $file,
]);
abort(403);
}
$fileRecord = $paymentRecord->files()->whereKey($file)->firstOrFail();
Log::info('Payment file accessed.', $context->auditPayload() + [
'payment_id' => $payment,
'file_id' => $file,
]);
return Storage::disk($fileRecord->disk ?? 'private')->download($fileRecord->path, $fileRecord->original_name);
}
}
@@ -0,0 +1,22 @@
<?php
declare(strict_types=1);
namespace App\Domain\SchoolCore\Payments;
use App\Domain\SchoolCore\Context\SchoolContext;
use Illuminate\Http\UploadedFile;
final readonly class RecordPaymentCommand
{
public function __construct(
public SchoolContext $context,
public int $invoiceId,
public int $studentId,
public string $method,
public int $amountCents,
public ?UploadedFile $file,
public ?string $idempotencyKey,
) {
}
}