Add Woo Manager Pro with multi-store switching and free-tier limits.
Deploy Ladill Woo Manager / deploy (push) Successful in 51s

Free: 1 store and 20 products. Pro/Business mirrors Invoice pricing (GHS 49/149)
with wallet renewals, Paystack prepay, session-based store switcher, and scoped UI.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-07-07 01:14:08 +00:00
co-authored by Cursor
parent 551473f8e5
commit cebf0d2e61
34 changed files with 1340 additions and 263 deletions
@@ -3,38 +3,64 @@
namespace App\Http\Controllers\Woo;
use App\Http\Controllers\Controller;
use App\Http\Controllers\Woo\Concerns\ResolvesWooContext;
use App\Models\WooCategory;
use App\Models\WooOrder;
use App\Models\WooProduct;
use App\Models\WooCategory;
use App\Models\WooStore;
use App\Services\Woo\SubscriptionService;
use Illuminate\Http\Request;
use Illuminate\View\View;
class DashboardController extends Controller
{
use ResolvesWooContext;
public function __construct(private SubscriptionService $subscriptions) {}
public function index(Request $request): View
{
$user = $request->user();
$storeIds = WooStore::query()->where('user_id', $user->id)->pluck('id');
$user = $this->accountUser($request);
$store = $this->currentStore($request);
$storeId = $store?->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(),
'products' => WooProduct::query()->whereIn('woo_store_id', $storeIds)->count(),
'categories' => WooCategory::query()->whereIn('woo_store_id', $storeIds)->count(),
'orders_new' => $storeId
? WooOrder::query()->where('woo_store_id', $storeId)->where('fulfillment_status', WooOrder::FULFILLMENT_NEW)->count()
: 0,
'orders_open' => $storeId
? WooOrder::query()->where('woo_store_id', $storeId)->whereNotIn('fulfillment_status', [
WooOrder::FULFILLMENT_DELIVERED,
WooOrder::FULFILLMENT_CANCELLED,
])->count()
: 0,
'products' => $storeId
? WooProduct::query()->where('woo_store_id', $storeId)->count()
: 0,
'categories' => $storeId
? WooCategory::query()->where('woo_store_id', $storeId)->count()
: 0,
];
$recent = WooOrder::query()
->whereIn('woo_store_id', $storeIds)
->with('store')
->latest('created_at')
->limit(8)
->get();
$recent = $storeId
? WooOrder::query()
->where('woo_store_id', $storeId)
->with('store')
->latest('created_at')
->limit(8)
->get()
: collect();
return view('woo.dashboard', compact('stats', 'recent'));
return view('woo.dashboard', [
'stats' => $stats,
'recent' => $recent,
'currentStore' => $store,
'hasPaidPlan' => $this->subscriptions->hasPaidPlan($user),
'productCount' => $this->subscriptions->productCount($user),
'productLimit' => $this->subscriptions->isPro($user) ? null : (int) config('woo.free.max_products', 20),
'storeCount' => $this->subscriptions->connectedStoreCount($user),
'storeLimit' => $this->subscriptions->isPro($user) ? null : (int) config('woo.free.max_stores', 1),
]);
}
}