Add User avatarUrl helper and harden dashboard billing lookup.
Deploy Ladill QR Plus / deploy (push) Successful in 23s
Deploy Ladill QR Plus / deploy (push) Successful in 23s
Fixes dashboard 500 after SSO when layout renders profile avatar. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -8,7 +8,9 @@ use App\Services\Billing\BillingClient;
|
||||
use App\Services\Qr\QrCodeManagerService;
|
||||
use App\Support\Qr\QrTypeCatalog;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\View\View;
|
||||
use Throwable;
|
||||
|
||||
class OverviewController extends Controller
|
||||
{
|
||||
@@ -38,12 +40,22 @@ class OverviewController extends Controller
|
||||
->get()
|
||||
->sum('scans_30d');
|
||||
|
||||
$balanceMinor = 0;
|
||||
try {
|
||||
$balanceMinor = $this->billing->balanceMinor($user->public_id);
|
||||
} catch (Throwable $e) {
|
||||
Log::warning('QR Plus dashboard could not load wallet balance', [
|
||||
'user' => $user->public_id,
|
||||
'error' => $e->getMessage(),
|
||||
]);
|
||||
}
|
||||
|
||||
return view('qr.dashboard', [
|
||||
'wallet' => $wallet,
|
||||
'recentCodes' => $codes,
|
||||
'activeCount' => $activeCount,
|
||||
'scans30d' => (int) $scans30d,
|
||||
'balanceMinor' => $this->billing->balanceMinor($user->public_id),
|
||||
'balanceMinor' => $balanceMinor,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,4 +44,11 @@ class User extends Authenticatable
|
||||
['credit_balance' => 0, 'qr_codes_total' => 0, 'scans_total' => 0, 'status' => QrWallet::STATUS_ACTIVE],
|
||||
);
|
||||
}
|
||||
|
||||
public function avatarUrl(): ?string
|
||||
{
|
||||
$url = trim((string) $this->avatar_url);
|
||||
|
||||
return $url !== '' ? $url : null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user