VPS and dedicated server ordering, managed panels, SSO, billing, and launcher integration — forked from hosting infrastructure with server-focused routes and dashboard. Co-authored-by: Cursor <cursoragent@cursor.com>
42 lines
1.2 KiB
PHP
42 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Email;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Services\EmailDomain\EmailDomainClient;
|
|
use App\Services\Mailbox\MailboxClient;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\View\View;
|
|
|
|
class OverviewController extends Controller
|
|
{
|
|
public function __construct(
|
|
private MailboxClient $mailboxes,
|
|
private EmailDomainClient $domains,
|
|
) {}
|
|
|
|
public function index(Request $request): View
|
|
{
|
|
$pid = (string) ladill_account()->public_id;
|
|
$mailboxes = [];
|
|
$domains = [];
|
|
$error = null;
|
|
|
|
try {
|
|
$mailboxes = $this->mailboxes->forUser($pid);
|
|
$domains = $this->domains->forUser($pid);
|
|
} catch (\Throwable $e) {
|
|
report($e);
|
|
$error = 'Some data could not be loaded right now.';
|
|
}
|
|
|
|
return view('email.dashboard', [
|
|
'mailboxCount' => count($mailboxes),
|
|
'domainCount' => count($domains),
|
|
'verifiedDomainCount' => collect($domains)->where('active', true)->count(),
|
|
'recent' => collect($mailboxes)->take(5)->all(),
|
|
'error' => $error,
|
|
]);
|
|
}
|
|
}
|