Files
ladill-woo-manager/app/Http/Controllers/Woo/DashboardController.php
T
isaaccladandCursor ffe0b9d877
Deploy Ladill Woo Manager / deploy (push) Failing after 2s
Scaffold Ladill Woo Manager for WooCommerce order fulfillment.
Standalone app with SSO shell, WordPress plugin connect flow, webhook ingest,
fulfillment inbox, and plugin activation API — no payment processing.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-06 22:39:38 +00:00

37 lines
1.2 KiB
PHP

<?php
namespace App\Http\Controllers\Woo;
use App\Http\Controllers\Controller;
use App\Models\WooOrder;
use App\Models\WooStore;
use Illuminate\Http\Request;
use Illuminate\View\View;
class DashboardController extends Controller
{
public function index(Request $request): View
{
$user = $request->user();
$storeIds = WooStore::query()->where('user_id', $user->id)->pluck('id');
$stats = [
'stores' => WooStore::query()->where('user_id', $user->id)->where('status', WooStore::STATUS_ACTIVE)->count(),
'orders_new' => WooOrder::query()->whereIn('woo_store_id', $storeIds)->where('fulfillment_status', WooOrder::FULFILLMENT_NEW)->count(),
'orders_open' => WooOrder::query()->whereIn('woo_store_id', $storeIds)->whereNotIn('fulfillment_status', [
WooOrder::FULFILLMENT_DELIVERED,
WooOrder::FULFILLMENT_CANCELLED,
])->count(),
];
$recent = WooOrder::query()
->whereIn('woo_store_id', $storeIds)
->with('store')
->latest('created_at')
->limit(8)
->get();
return view('woo.dashboard', compact('stats', 'recent'));
}
}