<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class CheckoutController extends Controller
{
    //
    public function index($param1)
    {
        $data['GeneralSettings'] = GeneralSettings();
        if (!empty(session('logged_in')) && session('logged_in') == 1) {

            $data['header_data'] = getWebSyncsData('Header Settings', 'headerSettings', '');
            $data['page'] = 'Services';
            $data['title'] = 'Checkout';
            $data['userDetails'] =  getUserDetails()->data[0];
            $data['nakshtra_data'] = getNakshtra()['data'];
            $data['gotra_data'] = getGotra()['data'];


            if ($param1 == 'sponsor') {
                $data['session_data'] = 'sponsor_cart';
                $data['redirect_url'] = 'puja-sponsorship';
            } else if ($param1 == 'service') {
                $data['session_data'] = 'service_cart';
                $data['redirect_url'] = 'services';
            } else if ($param1 == 'events') {
                $data['session_data'] = 'child_events';
            }

            return view('services.checkout', $data);
        } else {
            return redirect()->route('home');
        }
    }
}
