app/Http/Controllers/ContactController.php
/**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
Show the form for creating a new resource.
@return \Illuminate\Http\Response
Show the form for creating a new resource . @return \ Illuminate \ Http \ Response
public function create()
    {
        if (!auth()->user()->can('supplier.create') && !auth()->user()->can('customer.create')) {
            abort(403, 'Unauthorized action.');
        }
        $business_id = request()->session()->get('user.business_id');
        if (!$this->moduleUtil->isSubscribed($business_id)) {
            return $this->moduleUtil->expiredResponse();
        }
        $types = [];
        if (auth()->user()->can('supplier.create')) {
            $types['supplier'] = __('report.supplier');
        }
        if (auth()->user()->can('customer.create')) {
            $types['customer'] = __('report.customer');
        }
        if (auth()->user()->can('supplier.create') && auth()->user()->can('customer.create')) {
            $types['both'] = __('lang_v1.both_supplier_customer');
        }
        $customer_groups = CustomerGroup::forDropdown($business_id);
        $customer_areas = DB::table('KW_AREA')->get();
        return view('contact.create',['customer_areas' => $customer_areas])
            ->with(compact('types', 'customer_groups'));
    }
public function create ( ) { if ( ! auth ( ) -> user ( ) -> can ( 'supplier.create' ) && ! auth ( ) -> user ( ) -> can ( 'customer.create' ) ) { abort ( 403 , 'Unauthorized action.' ) ; } $ business_id = request ( ) -> session ( ) -> get ( 'user.business_id' ) ; if ( ! $ this -> moduleUtil -> isSubscribed ( $ business_id ) ) { return $ this -> moduleUtil -> expiredResponse ( ) ; } $ types = [ ] ; if ( auth ( ) -> user ( ) -> can ( 'supplier.create' ) ) { $ types [ 'supplier' ] = __ ( 'report.supplier' ) ; } if ( auth ( ) -> user ( ) -> can ( 'customer.create' ) ) { $ types [ 'customer' ] = __ ( 'report.customer' ) ; } if ( auth ( ) -> user ( ) -> can ( 'supplier.create' ) && auth ( ) -> user ( ) -> can ( 'customer.create' ) ) { $ types [ 'both' ] = __ ( 'lang_v1.both_supplier_customer' ) ; } $ customer_groups = CustomerGroup :: forDropdown ( $ business_id ) ; $ customer_areas = DB :: table ( 'KW_AREA' ) -> get ( ) ; return view ( 'contact.create' , [ 'customer_areas' => $ customer_areas ] ) -> with ( compact ( 'types' , 'customer_groups' ) ) ; }
Show the form for creating a new resource.
Show the form for creating a new resource .
//Check if subscribed or not