@php $isEdit = isset($package) && $package; $title = $isEdit ? 'Edit package' : 'Create package'; $action = $isEdit ? route('admin.packages.update', $package->id) : route('admin.packages.store'); $limitLabels = [ 'device_limit' => 'Devices', 'monthly_messages_limit' => 'Messages / month', 'contacts_limit' => 'Contacts', 'broadcast_limit' => 'Broadcasts', 'template_limit' => 'Templates', 'groups_limit' => 'Groups', 'campaign_messages_limit' => 'Campaign messages', 'automation_messages_limit' => 'Automation messages', 'broadcast_size_limit' => 'Broadcast size', 'total_campaigns_limit' => 'Total campaigns', 'active_campaign_limit' => 'Active campaigns', 'user_seat_limit' => 'Team seats', 'tags_limit' => 'Tags', 'flow_limit' => 'Flows', 'flow_steps_limit' => 'Steps per flow', 'autoreply_limit' => 'Keyword auto-replies', 'chatbot_limit' => 'Chatbots', 'scheduled_campaign_limit' => 'Scheduled campaigns', 'daily_media_size_allowance' => 'Daily media MB', 'workspaces_per_owner_limit' => 'Workspaces per owner', 'routing_rules_limit' => 'Routing rules', 'drip_campaigns_limit' => 'Drip campaigns', 'appointments_limit' => 'Appointments / month', 'ai_agents_limit' => 'AI agents', 'saved_replies_limit' => 'Quick replies', 'webhooks_limit' => 'Outbound webhooks', 'ai_token_limit_monthly' => 'AI tokens / month', // Sprint 9.5 caps. 'waba_calling_minutes_monthly' => 'WABA calling minutes / mo', 'ai_voice_minutes_monthly' => 'AI voice minutes / mo', 'ai_chat_messages_monthly' => 'AI chat messages / mo', 'ai_training_sources_limit' => 'AI training sources', 'chatbot_widgets_limit' => 'Chatbot website widgets', 'storefronts_limit' => 'WA storefronts', 'sla_policies_limit' => 'SLA policies', 'translation_chars_monthly' => 'Translation chars / mo', 'api_rate_limit_per_minute' => 'API rate limit / min (0 = default)', 'sms_monthly_limit' => 'SMS / month (0 = unlimited)', 'email_monthly_limit' => 'Emails / month (0 = unlimited)', // Social publishing caps. 'threads_accounts' => 'Threads accounts', 'threads_scheduled_posts' => 'Threads posts / month', 'linkedin_accounts' => 'LinkedIn accounts', 'linkedin_scheduled_posts' => 'LinkedIn posts / month', 'x_accounts' => 'X accounts', 'x_scheduled_posts' => 'X posts / month', ]; $featureLabels = [ 'autoreply' => 'Auto-reply system', 'bulkmessage' => 'Bulk messaging', 'schedulemessage' => 'Scheduled messages', 'ads' => 'Meta Ads integration', 'campaign' => 'Campaigns', 'autoflow' => 'Flow builder', 'broadcast' => 'Broadcasts', 'chatgpt_suggestion' => 'AI reply suggestions', 'template' => 'Templates', 'access_sms' => 'SMS (Twilio / MSG91)', 'access_email' => 'Email (linked mailbox)', 'access_carousel_templates' => 'Carousel templates', 'role_based_permissions' => 'Role-based permissions', 'access_drip_campaigns' => 'Drip campaigns', 'access_campaign_followups' => 'Campaign follow-ups', 'access_ctwa' => 'Click-to-WhatsApp ads', 'access_analytics' => 'Analytics dashboard', 'access_instagram' => 'Instagram automation', 'access_instagram_reposter' => 'Instagram Reels Autopilot', // Channels + lead-gen. 'access_lead_finder' => 'Lead Finder (map lead scraper)', 'access_facebook' => 'Facebook Pages channel', 'facebook_inbox' => 'Facebook — Messenger inbox', 'facebook_posts' => 'Facebook — publish posts', 'facebook_comments' => 'Facebook — comment management', 'facebook_ai_agent' => 'Facebook — AI agent', 'access_tiktok' => 'TikTok channel', 'tiktok_inbox' => 'TikTok — inbox', 'tiktok_posts' => 'TikTok — posting', 'tiktok_comments' => 'TikTok — comments', 'access_telegram' => 'Telegram channel', 'telegram_broadcasts' => 'Telegram — broadcasts', 'access_line' => 'LINE channel', 'line_broadcasts' => 'LINE — broadcasts', 'access_wechat' => 'WeChat channel', 'wechat_broadcasts' => 'WeChat — broadcasts', 'access_viber' => 'Viber channel', 'viber_broadcasts' => 'Viber — broadcasts', // Social publishing channels (core). 'access_threads' => 'Threads channel', 'threads_posts' => 'Threads — publish posts', 'threads_replies' => 'Threads — reply automation', 'threads_insights' => 'Threads — insights', 'access_linkedin' => 'LinkedIn channel', 'linkedin_posts' => 'LinkedIn — publish posts', 'linkedin_replies' => 'LinkedIn — comment auto-reply', 'access_x' => 'X (Twitter) channel', 'x_posts' => 'X — publish posts', 'x_replies' => 'X — mention auto-reply', 'x_insights' => 'X — post insights', 'remove_branding' => 'Remove ' . brand_name() . ' branding', 'integration_shopify' => 'Shopify integration', 'integration_woocommerce' => 'WooCommerce integration', 'integration_hubspot' => 'HubSpot integration', 'integration_google_calendar' => 'Google Calendar', 'integration_google_sheets' => 'Google Sheets', 'integration_slack' => 'Slack', 'integration_trello' => 'Trello', 'access_kanban_view' => 'Kanban view', 'access_appointment_booking' => 'Appointment booking', 'access_edit_messages' => 'Edit sent messages', 'access_internal_notes' => 'Internal notes', 'access_message_reactions' => 'Message reactions', 'access_routing_rules' => 'Routing rules', 'access_business_hours' => 'Business hours', 'access_team_performance' => 'Team performance', 'access_outbound_webhooks' => 'Outbound webhooks', 'access_keyword_replies' => 'Keyword auto-replies', 'access_ai_agents' => 'AI agents', 'allow_byok_ai_keys' => 'Bring your own AI keys', 'access_ai_custom_model' => 'Custom AI model endpoint', 'multipledevice' => 'Multi-device sending', 'file_type_restrictions' => 'File-type upload restrictions', // Sprint 9.5 toggles. 'access_waba_calling' => 'WhatsApp Cloud-API voice calling', 'access_call_recording' => 'Call recording', 'access_ai_voice_agent' => 'AI voice agent (answer calls)', 'ai_voice_reply' => 'AI voice auto-reply (voice notes)', 'access_ai_chat_assistant' => 'AI chat assistant (text)', 'access_ai_training' => 'AI training sources', 'access_ai_generate' => 'Inline "Generate with AI" buttons', 'access_wa_storefront' => 'WhatsApp Storefront / catalog', 'access_whatsapp_pay' => 'WhatsApp Pay (in-chat payments, India)', 'access_flows_commerce' => 'Commerce-aware flows', 'access_chatbot_widgets' => 'Chatbot website widgets', 'access_sla_policies' => 'SLA policies', 'access_translation' => 'Multilingual auto-translation', 'access_data_residency' => 'Data residency (EU/local) drivers', 'access_proxy_isolation' => 'Per-number proxy / dedicated IP', 'access_sales_pipeline' => 'Sales pipeline (Deal CRM)', 'access_whatsapp_warmer' => 'WhatsApp number warm-up', 'auto_invoice' => 'Automatic invoices', ]; // Logical limit groups (mapped to the columns the form ships with). $limitGroups = [ 'Messaging caps' => [ 'monthly_messages_limit', 'broadcast_limit', 'broadcast_size_limit', 'campaign_messages_limit', 'automation_messages_limit', 'scheduled_campaign_limit', 'total_campaigns_limit', 'active_campaign_limit', 'daily_media_size_allowance', 'sms_monthly_limit', 'email_monthly_limit', ], 'Workspace caps' => [ 'device_limit', 'user_seat_limit', 'contacts_limit', 'groups_limit', 'workspaces_per_owner_limit', 'tags_limit', ], 'Content caps' => [ 'template_limit', 'flow_limit', 'flow_steps_limit', 'autoreply_limit', 'chatbot_limit', 'saved_replies_limit', ], 'AI & voice caps' => [ 'waba_calling_minutes_monthly', 'ai_voice_minutes_monthly', 'ai_chat_messages_monthly', 'ai_agents_limit', 'ai_training_sources_limit', 'ai_token_limit_monthly', ], 'Commerce & SLA' => [ 'storefronts_limit', 'chatbot_widgets_limit', 'sla_policies_limit', 'translation_chars_monthly', 'drip_campaigns_limit', 'appointments_limit', ], 'Social publishing caps' => [ 'threads_accounts', 'threads_scheduled_posts', 'linkedin_accounts', 'linkedin_scheduled_posts', 'x_accounts', 'x_scheduled_posts', ], 'Other caps' => ['webhooks_limit', 'routing_rules_limit', 'api_rate_limit_per_minute'], ]; // Logical feature groups. $featureGroups = [ 'Messaging' => [ 'autoreply', 'bulkmessage', 'schedulemessage', 'campaign', 'autoflow', 'broadcast', 'template', 'access_carousel_templates', 'access_drip_campaigns', 'access_campaign_followups', 'access_keyword_replies', 'access_edit_messages', 'access_message_reactions', ], // Extra channels beyond WhatsApp/Instagram. Each top-level access_* is // the channel on/off gate (enforced in the channel connect controllers); // the sub-toggles gate individual capabilities within that channel. 'Channels' => [ 'access_sms', 'access_email', 'access_facebook', 'facebook_inbox', 'facebook_posts', 'facebook_comments', 'facebook_ai_agent', 'access_tiktok', 'tiktok_inbox', 'tiktok_posts', 'tiktok_comments', 'access_telegram', 'telegram_broadcasts', 'access_line', 'line_broadcasts', 'access_wechat', 'wechat_broadcasts', 'access_viber', 'viber_broadcasts', // Social publishing channels. 'access_threads', 'threads_posts', 'threads_replies', 'threads_insights', 'access_linkedin', 'linkedin_posts', 'linkedin_replies', 'access_x', 'x_posts', 'x_replies', 'x_insights', ], 'Inbox & team' => [ 'access_internal_notes', 'access_routing_rules', 'access_business_hours', 'access_team_performance', 'access_kanban_view', 'access_appointment_booking', 'access_sla_policies', 'role_based_permissions', ], 'AI & calling' => [ 'access_waba_calling', 'access_call_recording', 'access_ai_voice_agent', 'ai_voice_reply', 'access_ai_chat_assistant', 'access_ai_training', 'access_ai_generate', 'access_ai_agents', 'allow_byok_ai_keys', 'access_ai_custom_model', 'chatgpt_suggestion', ], 'Commerce' => [ 'access_wa_storefront', 'access_whatsapp_pay', 'access_flows_commerce', 'access_chatbot_widgets', 'auto_invoice', 'integration_shopify', 'integration_woocommerce', ], 'Integrations' => [ 'integration_hubspot', 'integration_google_calendar', 'integration_google_sheets', 'integration_slack', 'integration_trello', 'access_outbound_webhooks', ], 'Advanced' => [ 'ads', 'access_ctwa', 'access_analytics', 'multipledevice', 'file_type_restrictions', 'access_translation', 'access_data_residency', 'access_proxy_isolation', 'access_sales_pipeline', 'access_lead_finder', 'access_whatsapp_warmer', 'remove_branding', ], ]; // ---- Extension-contributed plan fields ------------------------------- // The form renders from $featureGroups / $limitGroups and then filters // against the controller's column lists — a key must appear in BOTH or it // silently never renders. That double gate is exactly why the Instagram // flags were invisible while still being saved as false on every submit. // // Merging here closes it: an installed extension's flags get a group, a // label and a rendered input, and they disappear again when it is removed. foreach (\App\Services\ExtensionRegistry::planFeatures() as $key => $meta) { $featureLabels[$key] = $meta['label']; $featureGroups[$meta['group']][] = $key; } foreach (\App\Services\ExtensionRegistry::planLimits() as $key => $meta) { $limitLabels[$key] = $meta['label']; $limitGroups[$meta['group']][] = $key; } // Instagram add-on gets its OWN wizard step — pull its feature toggles and // limit inputs out of the generic Features/Limits groups so they render // together on a dedicated "Instagram" step (only when the add-on is // installed, i.e. it contributed any Instagram-group fields). $igFeatures = array_values(array_unique($featureGroups['Instagram'] ?? [])); $igLimits = array_values(array_unique($limitGroups['Instagram'] ?? [])); unset($featureGroups['Instagram'], $limitGroups['Instagram']); $hasIgStep = !empty($igFeatures) || !empty($igLimits); $val = function ($field, $default = null) use ($package) { return old($field, $package->{$field} ?? $default); }; @endphp
{{ __('Admin') }} {{ __('Packages') }} {{ $isEdit ? 'Edit' : 'New' }}
{{ __('Step') }} 1 / {{ $hasIgStep ? 5 : 4 }} {{ __('Cancel') }}
Admin · Packages · {{ $isEdit ? 'Edit' : 'New' }}

{{ $isEdit ? 'Edit' : 'Create a' }} {{ $isEdit ? 'package' : 'package' }}

{{ __("Set pricing, numeric limits, feature toggles, and display options. Empty limit field = unlimited. Unchecked toggle = workspaces on this plan can't use that feature.") }}

@if (session('success'))
{{ session('success') }}
@endif @if (session('error'))
{{ session('error') }}
@endif @if ($errors->any())
{{ __('Please fix the following:') }}
    @foreach ($errors->all() as $e)
  • {{ $e }}
  • @endforeach
@endif
@csrf @if ($isEdit) @method('PATCH') @endif
{{-- Stepper bar --}}
@php $steps = $hasIgStep ? ['Basics', 'Limits', 'Features', 'Instagram', 'Display & review'] : ['Basics', 'Limits', 'Features', 'Display & review']; @endphp @foreach ($steps as $i => $label)
{{ $loop->iteration }} {{ $label }} @if (!$loop->last) @endif
@endforeach
{{-- STEP 1 — Basics --}}
01 {{ __('Plan basics') }} {{ __('required') }}
{{-- Package type + data retention. An ADD-ON grants its toggles/limits ON TOP of a customer's plan (they buy it instead of upgrading); data-retention auto-wipes a workspace's data N days after expiry. --}}
{{ __('Add-on: toggle only the features/limits it grants below; customers buy it to unlock those without changing plan.') }}
{{ __('0 = never. After the plan is expired this many days, the workspace\'s data is auto-wiped.') }}
0 = free. Set "Free plan" toggle below.
e.g. 1 month = monthly recurring, 1 year = annual.
@php $basicsFlags = [ 'free' => ['Free plan', 'No charge, no recurring billing'], 'lifetime' => ['Lifetime', 'One-time payment, no renewal'], 'status' => ['Active', 'Visible on the public pricing page'], 'is_default' => [ 'Default for signups', 'New workspaces get this plan automatically', ], 'is_highlighted' => ['Highlight as popular', 'Adds "Most popular" badge'], 'is_custom_quote' => ['Custom quote', 'Hides price, shows "Contact sales"'], ]; @endphp @foreach ($basicsFlags as $name => $meta) @endforeach
{{-- STEP 2 — Limits --}} {{-- STEP 3 — Features --}} {{-- STEP 4 — Instagram add-on (only when the add-on contributed fields) --}} @if ($hasIgStep) @endif {{-- FINAL STEP — Display + Review --}}