当前位置: 首页>>代码示例>>PHP>>正文


PHP Eloquent::whereRaw方法代码示例

本文整理汇总了PHP中Eloquent::whereRaw方法的典型用法代码示例。如果您正苦于以下问题:PHP Eloquent::whereRaw方法的具体用法?PHP Eloquent::whereRaw怎么用?PHP Eloquent::whereRaw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Eloquent的用法示例。


在下文中一共展示了Eloquent::whereRaw方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: doColumnSearch

 /**
  * Perform column search
  *
  * @return void
  */
 public function doColumnSearch()
 {
     $input = $this->input;
     $columns = $input['columns'];
     // if older version, set the column name to query's fields
     // or if new version but does not use mData support
     if (!$this->new_version or !$this->mDataSupport and $this->new_version) {
         for ($i = 0; $i < count($columns); $i++) {
             if (!isset($this->columns[$i])) {
                 continue;
             }
             $columns[$i]['name'] = $this->columns[$i];
             if (stripos($columns[$i]['name'], ' AS ') !== false or $columns[$i]['name'] instanceof Expression) {
                 $columns[$i]['name'] = '';
                 $columns[$i]['searchable'] = false;
                 $columns[$i]['orderable'] = false;
             }
         }
     }
     for ($i = 0, $c = count($columns); $i < $c; $i++) {
         if ($columns[$i]['searchable'] == "true" and !empty($columns[$i]['search']['value']) and !empty($columns[$i]['name'])) {
             $column = $columns[$i]['name'];
             $keyword = $this->setupKeyword($columns[$i]['search']['value']);
             // wrap column possibly allow reserved words to be used as column
             $column = $this->wrapColumn($column);
             if ($this->isCaseInsensitive()) {
                 $this->query->whereRaw('LOWER(' . $column . ') LIKE ?', [strtolower($keyword)]);
             } else {
                 $col = strstr($column, '(') ? $this->connection->raw($column) : $column;
                 $this->query->where($col, 'LIKE', $keyword);
             }
         }
     }
 }
开发者ID:testoodoo,项目名称:OoodooSiteUp,代码行数:39,代码来源:Datatables.php

示例2: doColumnSearch

 /**
  * Perform column search
  *
  * @param  array $columns
  * @return void
  */
 public function doColumnSearch(array $columns)
 {
     for ($i = 0, $c = count($columns); $i < $c; $i++) {
         if ($columns[$i]['searchable'] == "true" and !empty($columns[$i]['search']['value']) and !empty($columns[$i]['name'])) {
             $column = $columns[$i]['name'];
             $keyword = $this->setupKeyword($columns[$i]['search']['value']);
             // wrap column possibly allow reserved words to be used as column
             $column = $this->wrapColumn($column);
             if ($this->isCaseInsensitive()) {
                 $this->query->whereRaw('LOWER(' . $column . ') LIKE ?', [strtolower($keyword)]);
             } else {
                 $col = strstr($column, '(') ? $this->connection->raw($column) : $column;
                 $this->query->where($col, 'LIKE', $keyword);
             }
         }
     }
 }
开发者ID:kimnv57,项目名称:laravel-simple-api-ueter-aide,代码行数:23,代码来源:Datatables.php


注:本文中的Eloquent::whereRaw方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。