app/Http/Controllers/ContactController.php
/**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
Display a listing of the resource.
@return \Illuminate\Http\Response
Display a listing of the resource . @return \ Illuminate \ Http \ Response
public function index(Request $request)
    {
        $type = request()->get('type');
        $types = ['supplier', 'customer','regular'];
        if (empty($type) || !in_array($type, $types)) {
            return redirect()->back();
        }
        if (request()->ajax()) {
            if ($type == 'supplier') {
                return $this->indexSupplier();
            } elseif ($type == 'customer') {
                return $this->indexCustomer($request);
            } elseif($type == 'regular'){
                return $this->indexRegularCustomers($request);
            } else {
                die("Not Found");
            }
        }
        $reward_enabled = (request()->session()->get('business.enable_rp') == 1 && in_array($type, ['customer'])) ? true : false;
        if($type == 'regular'){
            return view('contact.regular');
        }
        return view('contact.index')
            ->with(compact('type', 'reward_enabled'));
    }
public function index ( Request $ request ) { $ type = request ( ) -> get ( 'type' ) ; $ types = [ 'supplier' , 'customer' , 'regular' ] ; if ( empty ( $ type ) || ! in_array ( $ type , $ types ) ) { return redirect ( ) -> back ( ) ; } if ( request ( ) -> ajax ( ) ) { if ( $ type == 'supplier' ) { return $ this -> indexSupplier ( ) ; } elseif ( $ type == 'customer' ) { return $ this -> indexCustomer ( $ request ) ; } elseif ( $ type == 'regular' ) { return $ this -> indexRegularCustomers ( $ request ) ; } else { die ( " Not Found " ) ; } } $ reward_enabled = ( request ( ) -> session ( ) -> get ( 'business.enable_rp' ) == 1 && in_array ( $ type , [ 'customer' ] ) ) ? true : false ; if ( $ type == 'regular' ) { return view ( 'contact.regular' ) ; } return view ( 'contact.index' ) -> with ( compact ( 'type' , 'reward_enabled' ) ) ; }
Display a listing of the resource.
Display a listing of the resource .