Deploy Ladill QR Plus / deploy (push) Successful in 28s
Full control center for ticketed events, contributions, attendees, badges, and programmes — not a QR utility clone. Includes SSO shell, import command, and platform cutover runbook. Co-authored-by: Cursor <cursoragent@cursor.com>
46 lines
1.2 KiB
PHP
46 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Events;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\QrCode;
|
|
use App\Models\QrEventRegistration;
|
|
use App\Services\Billing\BillingClient;
|
|
use Illuminate\Support\Facades\Log;
|
|
use Illuminate\View\View;
|
|
use Throwable;
|
|
|
|
class PayoutsController extends Controller
|
|
{
|
|
public function __construct(private BillingClient $billing) {}
|
|
|
|
public function index(): View
|
|
{
|
|
$account = ladill_account();
|
|
|
|
$eventIds = $account->qrCodes()
|
|
->where('type', QrCode::TYPE_EVENT)
|
|
->pluck('id');
|
|
|
|
$revenueMinor = (int) QrEventRegistration::query()
|
|
->whereIn('qr_code_id', $eventIds)
|
|
->where('status', QrEventRegistration::STATUS_CONFIRMED)
|
|
->sum('amount_minor');
|
|
|
|
$balanceMinor = 0;
|
|
try {
|
|
$balanceMinor = $this->billing->balanceMinor($account->public_id);
|
|
} catch (Throwable $e) {
|
|
Log::warning('Events payouts could not load wallet balance', [
|
|
'user' => $account->public_id,
|
|
'error' => $e->getMessage(),
|
|
]);
|
|
}
|
|
|
|
return view('events.payouts', [
|
|
'revenueMinor' => $revenueMinor,
|
|
'balanceMinor' => $balanceMinor,
|
|
]);
|
|
}
|
|
}
|