Add per-store managers for Woo Business accounts.
Deploy Ladill Woo Manager / deploy (push) Successful in 39s
Deploy Ladill Woo Manager / deploy (push) Successful in 39s
Agencies can invite store-scoped managers via Identity, with access limited to one WooCommerce store while owners retain full multi-store control. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -23,23 +23,28 @@ class StoreController extends Controller
|
||||
public function index(Request $request): View
|
||||
{
|
||||
$user = $this->accountUser($request);
|
||||
$storeScope = $this->storeScope($request);
|
||||
|
||||
$stores = WooStore::query()
|
||||
->where('user_id', $user->id)
|
||||
->when($storeScope !== null, fn ($q) => $q->whereIn('id', $storeScope))
|
||||
->latest('updated_at')
|
||||
->get();
|
||||
|
||||
return view('woo.stores.index', [
|
||||
'stores' => $stores,
|
||||
'currentStore' => $this->currentStore->resolve($user),
|
||||
'currentStore' => $this->currentStore->resolve($user, $storeScope),
|
||||
'hasPaidPlan' => $this->subscriptions->hasPaidPlan($user),
|
||||
'storeCount' => $this->subscriptions->connectedStoreCount($user),
|
||||
'storeLimit' => $this->subscriptions->maxStores($user),
|
||||
'canConnectMore' => $this->subscriptions->canConnectStore($user),
|
||||
'canConnectMore' => $this->isStoreOwner($request) && $this->subscriptions->canConnectStore($user),
|
||||
'isStoreOwner' => $this->isStoreOwner($request),
|
||||
]);
|
||||
}
|
||||
|
||||
public function destroy(Request $request, WooStore $store): RedirectResponse
|
||||
{
|
||||
abort_if(! $this->isStoreOwner($request), 403);
|
||||
abort_if($store->user_id !== $this->accountUser($request)->id, 403);
|
||||
|
||||
$store->update(['status' => WooStore::STATUS_DISCONNECTED]);
|
||||
|
||||
Reference in New Issue
Block a user