@php use App\User; use App\Plan; use App\BusinessCard; use Carbon\Carbon; // Card details $business_card = BusinessCard::where('card_id', Request::segment(3))->first(); // Fetch the user plan $plan = User::where('id', Auth::user()->id) ->where('status', 1) ->first(); $planData = json_decode($plan->plan_details, true); if ($planData) { // Fetch the default plan details only once if necessary if (!$planData || !isset($planData['appointment'])) { $planDefaults = Plan::where('plan_id', $plan->plan_id)->first(); } // Check and assign missing plan details $planData['appointment'] = $planData['appointment'] ?? $planDefaults->appointment; // Update plan details if necessary if ($planData !== json_decode($plan->plan_details, true)) { $plan->plan_details = json_encode($planData); $plan->updated_at = Carbon::now(); $plan->save(); } // Fetch the updated plan details $plan_details = json_decode($plan->plan_details, true); } @endphp {{ __('Basic Details') }} @if ($business_card->type == 'personal') @if ($plan_details['no_of_links'] > 0) {{ __('Social Links') }} @endif @if ($plan_details['appointment'] == 1) {{ __('Appointment') }} @endif @endif @if ($business_card->type == 'business' || $business_card->type == 'custom') @if ($plan_details['no_of_links'] > 0) {{ __('Social Links') }} @endif @if ($plan_details['no_of_payments'] > 0) {{ __('Payment Links') }} @endif @if ($plan_details['no_of_services'] > 0) {{ __('Services') }} @endif @if ($plan_details['no_of_vcard_products'] > 0) {{ __('Products') }} @endif @if ($plan_details['no_of_galleries'] > 0) {{ __('Galleries') }} @endif @if ($plan_details['no_testimonials'] > 0) {{ __('Testimonials') }} @endif {{ __('Popups') }} @if ($plan_details['business_hours'] == 1) {{ __('Business Hours') }} @endif @if ($plan_details['appointment'] == 1) {{ __('Appointment') }} @endif @if ($plan_details['contact_form'] == 1) {{ __('Contact Form') }} @endif @if (isset($plan_details['service_booking']) && $plan_details['service_booking'] == 1) {{ __('Service Booking') }} @endif @if ($business_card->type == 'custom') {{ __('Customization') }} @endif @endif @if ($plan_details['password_protected'] == 1 || $plan_details['advanced_settings'] == 1) {{ __('Advanced Settings') }} @endif