Add Woo Manager Pro with multi-store switching and free-tier limits.
Deploy Ladill Woo Manager / deploy (push) Successful in 51s
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:
@@ -3,29 +3,51 @@
|
||||
namespace App\Http\Controllers\Woo;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\Woo\Concerns\ResolvesWooContext;
|
||||
use App\Models\WooStore;
|
||||
use App\Services\Woo\SubscriptionService;
|
||||
use App\Support\CurrentWooStore;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class StoreController extends Controller
|
||||
{
|
||||
use ResolvesWooContext;
|
||||
|
||||
public function __construct(
|
||||
private SubscriptionService $subscriptions,
|
||||
private CurrentWooStore $currentStore,
|
||||
) {}
|
||||
|
||||
public function index(Request $request): View
|
||||
{
|
||||
$user = $this->accountUser($request);
|
||||
$stores = WooStore::query()
|
||||
->where('user_id', $request->user()->id)
|
||||
->where('user_id', $user->id)
|
||||
->latest('updated_at')
|
||||
->get();
|
||||
|
||||
return view('woo.stores.index', compact('stores'));
|
||||
return view('woo.stores.index', [
|
||||
'stores' => $stores,
|
||||
'currentStore' => $this->currentStore->resolve($user),
|
||||
'hasPaidPlan' => $this->subscriptions->hasPaidPlan($user),
|
||||
'storeCount' => $this->subscriptions->connectedStoreCount($user),
|
||||
'storeLimit' => $this->subscriptions->maxStores($user),
|
||||
'canConnectMore' => $this->subscriptions->canConnectStore($user),
|
||||
]);
|
||||
}
|
||||
|
||||
public function destroy(Request $request, WooStore $store): RedirectResponse
|
||||
{
|
||||
abort_if($store->user_id !== $request->user()->id, 403);
|
||||
abort_if($store->user_id !== $this->accountUser($request)->id, 403);
|
||||
|
||||
$store->update(['status' => WooStore::STATUS_DISCONNECTED]);
|
||||
|
||||
if ((int) session(CurrentWooStore::SESSION_KEY) === $store->id) {
|
||||
session()->forget(CurrentWooStore::SESSION_KEY);
|
||||
}
|
||||
|
||||
return back()->with('success', 'Store disconnected. Install the Ladill plugin again to reconnect.');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user