public static function getIndexRecords($request, $parameters)
    {
        $instance = new static;

        if(method_exists($instance, 'addToGetIndexRecords'))
            $query = $instance->addToGetIndexRecords($request, $parameters);
        else
            if(method_exists($instance, 'scopeBuilder'))
                $query = $instance->builder();
            else
                $query = $instance->query();

        $query = Miscellaneous::getQueryWhere($request, $query, $parameters);

        if(isset($parameters['count']) &&  $parameters['count'])
        {
            // if we need count results
            if(method_exists($instance, 'customCountIndexRecords'))
                return $instance->customCountIndexRecords($query, $parameters);
            else
                return $query->count();
        }
        else
        {
            // if we need limit and order results
            if(isset($parameters['length']))
                $query->take($parameters['length']);

            if(isset($parameters['start']))
                $query->skip($parameters['start']);

            if(isset($parameters['order']) && is_array($parameters['order']))
                $query->orderBy($parameters['order']['column'], isset($parameters['order']['dir'])? $parameters['order']['dir'] : 'asc');


            if(method_exists($instance, 'getCustomReturnIndexRecords'))
            {
                // if we need a custom get()
                return $instance->getCustomReturnIndexRecords($query, $parameters);
            }
            else
            {
                // if has diplayColumns variable
                if(isset($parameters['displayColumns']) && is_array($parameters['displayColumns']) && count($parameters['displayColumns']) > 0)
                    return $query->get($parameters['displayColumns']);
                else
                    return $query->get();
            }
        }
    }
public static function getIndexRecords($request, $parameters)
    {
        $instance = new static;

        if(method_exists($instance, 'addToGetIndexRecords'))
            $query = $instance->addToGetIndexRecords($request, $parameters);
        else
            if(method_exists($instance, 'scopeBuilder'))
                $query = $instance->builder();
            else
                $query = $instance->query();

        $query = Miscellaneous::getQueryWhere($request, $query, $parameters);

        if(isset($parameters['count']) &&  $parameters['count'])
        {
            // if we need count results
            if(method_exists($instance, 'customCountIndexRecords'))
                return $instance->customCountIndexRecords($query, $parameters);
            else
                return $query->count();
        }
        else
        {
            // if we need limit and order results
            if(isset($parameters['length']))
                $query->take($parameters['length']);

            if(isset($parameters['start']))
                $query->skip($parameters['start']);

            if(isset($parameters['order']) && is_array($parameters['order']))
                $query->orderBy($parameters['order']['column'], isset($parameters['order']['dir'])? $parameters['order']['dir'] : 'asc');


            if(method_exists($instance, 'getCustomReturnIndexRecords'))
            {
                // if we need a custom get()
                return $instance->getCustomReturnIndexRecords($query, $parameters);
            }
            else
            {
                // if has diplayColumns variable
                if(isset($parameters['displayColumns']) && is_array($parameters['displayColumns']) && count($parameters['displayColumns']) > 0)
                    return $query->get($parameters['displayColumns']);
                else
                    return $query->get();
            }
        }
    }
public static function getIndexRecords ( $ request , $ parameters ) { $ instance = new static ; if ( method_exists ( $ instance , 'addToGetIndexRecords' ) ) $ query = $ instance -> addToGetIndexRecords ( $ request , $ parameters ) ; else if ( method_exists ( $ instance , 'scopeBuilder' ) ) $ query = $ instance -> builder ( ) ; else $ query = $ instance -> query ( ) ; $ query = Miscellaneous :: getQueryWhere ( $ request , $ query , $ parameters ) ; if ( isset ( $ parameters [ 'count' ] ) && $ parameters [ 'count' ] ) { // if we need count results if ( method_exists ( $ instance , 'customCountIndexRecords' ) ) return $ instance -> customCountIndexRecords ( $ query , $ parameters ) ; else return $ query -> count ( ) ; } else { // if we need limit and order results if ( isset ( $ parameters [ 'length' ] ) ) $ query -> take ( $ parameters [ 'length' ] ) ; if ( isset ( $ parameters [ 'start' ] ) ) $ query -> skip ( $ parameters [ 'start' ] ) ; if ( isset ( $ parameters [ 'order' ] ) && is_array ( $ parameters [ 'order' ] ) ) $ query -> orderBy ( $ parameters [ 'order' ] [ 'column' ] , isset ( $ parameters [ 'order' ] [ 'dir' ] ) ? $ parameters [ 'order' ] [ 'dir' ] : 'asc' ) ; if ( method_exists ( $ instance , 'getCustomReturnIndexRecords' ) ) { // if we need a custom get() return $ instance -> getCustomReturnIndexRecords ( $ query , $ parameters ) ; } else { // if has diplayColumns variable if ( isset ( $ parameters [ 'displayColumns' ] ) && is_array ( $ parameters [ 'displayColumns' ] ) && count ( $ parameters [ 'displayColumns' ] ) > 0 ) return $ query -> get ( $ parameters [ 'displayColumns' ] ) ; else return $ query -> get ( ) ; } } }
Function to get data record to list objects

@access	public
@param   \Illuminate\Http\Request    $request
@param   array                       $parameters
@return	array|\Illuminate\Database\Eloquent\Model[]
Function to get data record to list objects