package-product/Models/Product.php
/**
     *
     * @param ARRAY $params list of parameters
     * @return ELOQUENT OBJECT
     */
@param ARRAY $params list of parameters
@return ELOQUENT OBJECT
@param ARRAY $params list of parameters @return ELOQUENT OBJECT
protected function searchFilters(array $params = [], $elo, $by_status = TRUE){
        if (!empty($params))
        {
            foreach($params as $column => $value)
            {
                if($this->isValidValue($value))
                {
                    switch($column)
                    {
                        case 'name':
                            if (!empty($value)) {
                                $elo = $elo->where($this->table . '.name', '=', $value);
                            }
                            break;
                        case 'status':
                            if (!empty($value)) {
                                $elo = $elo->where($this->table . '.'.$this->field_status, '=', $value);
                            }
                            break;
                        case 'keyword':
                            if (!empty($value)) {
                                $elo = $elo->where(function($elo) use ($value) {
                                    $elo->where($this->table . '.name', 'LIKE', "%{$value}%")
                                    ->orWhere($this->table . '.description','LIKE', "%{$value}%")
                                    ->orWhere($this->table . '.price','LIKE', "%{$value}%");
                                });
                            }
                            break;
                        default:
                            break;
                    }
                }
            }
        } elseif ($by_status) {
        }
        return $elo;
    }
protected function searchFilters ( array $ params = [ ] , $ elo , $ by_status = TRUE ) { if ( ! empty ( $ params ) ) { foreach ( $ params as $ column => $ value ) { if ( $ this -> isValidValue ( $ value ) ) { switch ( $ column ) { case 'name' : if ( ! empty ( $ value ) ) { $ elo = $ elo -> where ( $ this -> table . '.name' , '=' , $ value ) ; } break ; case 'status' : if ( ! empty ( $ value ) ) { $ elo = $ elo -> where ( $ this -> table . '.' . $ this -> field_status , '=' , $ value ) ; } break ; case 'keyword' : if ( ! empty ( $ value ) ) { $ elo = $ elo -> where ( function ( $ elo ) use ( $ value ) { $ elo -> where ( $ this -> table . '.name' , 'LIKE' , " % { $ value } % " ) -> orWhere ( $ this -> table . '.description' , 'LIKE' , " % { $ value } % " ) -> orWhere ( $ this -> table . '.price' , 'LIKE' , " % { $ value } % " ) ; } ) ; } break ; default : break ; } } } } elseif ( $ by_status ) { } return $ elo ; }
@param ARRAY $params list of parameters
 @return ELOQUENT OBJECT
@param ARRAY $params list of parameters @return ELOQUENT OBJECT
//filter // dd($this->isValidFilters($params) || (!empty($params))); // $elo = $elo->where($this->table . '.'.$this->field_status, '=', $this->status['publish']); // $products = $elo->get()->toArray(); // return $products; //dd($elo);