Move Branches and Team into Settings as Pro features.
Deploy Ladill Frontdesk / deploy (push) Successful in 48s
Deploy Ladill Frontdesk / deploy (push) Successful in 48s
Gate multi-branch and team management behind paid plans, nest their routes under Settings, and remove them from the sidebar Administration section.
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Frontdesk\Concerns;
|
||||
|
||||
use App\Services\Frontdesk\PlanService;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\View\View;
|
||||
|
||||
trait RequiresPlanFeature
|
||||
{
|
||||
/**
|
||||
* For page views: return an upgrade screen when the org lacks the feature.
|
||||
*/
|
||||
protected function proFeatureUpgradeView(
|
||||
Request $request,
|
||||
string $feature,
|
||||
string $title,
|
||||
string $description,
|
||||
): ?View {
|
||||
$organization = $this->organization($request);
|
||||
$plans = app(PlanService::class);
|
||||
|
||||
if ($plans->hasFeature($organization, $feature)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return view('frontdesk.settings.pro-feature', [
|
||||
'organization' => $organization,
|
||||
'title' => $title,
|
||||
'description' => $description,
|
||||
'proPriceMinor' => $plans->proPricePerBranchMinor(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* For mutations: redirect free-plan orgs to the plans page.
|
||||
*/
|
||||
protected function denyWithoutFeature(
|
||||
Request $request,
|
||||
string $feature,
|
||||
string $message,
|
||||
): ?RedirectResponse {
|
||||
$organization = $this->organization($request);
|
||||
if (app(PlanService::class)->hasFeature($organization, $feature)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return redirect()
|
||||
->route('frontdesk.pro.index')
|
||||
->with('error', $message);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user