38 lines
1.2 KiB
PHP
38 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace Modules\Licensing\Http\Controllers\Admin;
|
|
|
|
use Illuminate\Contracts\View\View;
|
|
use Illuminate\Routing\Controller;
|
|
use Modules\Licensing\Models\License;
|
|
use Modules\Licensing\Models\LicenseProduct;
|
|
|
|
final class LicensingDashboardController extends Controller
|
|
{
|
|
public function index(): View
|
|
{
|
|
return view('licensing::admin.index', [
|
|
'licenseCount' => License::query()->count(),
|
|
'activeCount' => License::query()->whereNull('revoked_at')->where(function ($q): void {
|
|
$q->whereNull('expires_at')->orWhere('expires_at', '>', now());
|
|
})->count(),
|
|
'productCount' => LicenseProduct::query()->count(),
|
|
'recentLicenses' => License::query()->with('product')->latest()->limit(10)->get(),
|
|
]);
|
|
}
|
|
|
|
public function licenses(): View
|
|
{
|
|
return view('licensing::admin.licenses', [
|
|
'licenses' => License::query()->with('product')->latest()->paginate(25),
|
|
]);
|
|
}
|
|
|
|
public function show(License $license): View
|
|
{
|
|
return view('licensing::admin.show', [
|
|
'license' => $license->load(['product', 'activations']),
|
|
]);
|
|
}
|
|
}
|