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
+58
View File
@@ -0,0 +1,58 @@
<?php
namespace App\Support;
use App\Models\User;
use App\Models\WooStore;
use Illuminate\Support\Collection;
class CurrentWooStore
{
public const SESSION_KEY = 'woo.current_store_id';
public function activeStores(User $user): Collection
{
return WooStore::query()
->where('user_id', $user->id)
->where('status', WooStore::STATUS_ACTIVE)
->orderBy('site_name')
->orderBy('site_url')
->get();
}
public function resolve(?User $user): ?WooStore
{
if (! $user) {
return null;
}
$stores = $this->activeStores($user);
if ($stores->isEmpty()) {
return null;
}
$selectedId = (int) session(self::SESSION_KEY, 0);
$store = $stores->firstWhere('id', $selectedId);
if ($store) {
return $store;
}
$first = $stores->first();
session([self::SESSION_KEY => $first->id]);
return $first;
}
public function switch(User $user, int $storeId): WooStore
{
$store = WooStore::query()
->where('user_id', $user->id)
->whereKey($storeId)
->where('status', WooStore::STATUS_ACTIVE)
->firstOrFail();
session([self::SESSION_KEY => $store->id]);
return $store;
}
}