Laravel 5 Query Builder不返回任何数据

时间:2015-07-06 14:14:24

标签: php mysql laravel orm eloquent

我的应用程序中有一些嵌套查询,例如示例follow。

$arrData = DB::table('service as tsv')
            ->select($afields)
            ->join('shops as ts', 'ts.id', '=', 'tsv.shop_id')
            ->where('ts.name','like','%'.$searchstring.'%');

if(!empty($type) && $type == 'individual')
    $arrData->where('ts.type','=', '1');

$arrData->groupBy('tsv.id')->get();

此查询未返回显示内容的确切输出,如

Builder {#351 ▼
  #connection: MySqlConnection {#336 ▶}
  #grammar: MySqlGrammar {#347 ▶}
  #processor: MySqlProcessor {#348}
  #bindings: array:5 [▶]
  +aggregate: null
  +columns: array:7 [▶]
  +distinct: false
  +from: "service as tsv"
  +joins: array:3 [▶]
  +wheres: array:3 [▶]
  +groups: array:1 [▶]
  +havings: null
  +orders: array:1 [▶]
  +limit: 4
  +offset: 0
  +unions: null
  +unionLimit: null
  +unionOffset: null
  +unionOrders: null
  +lock: null
  #backups: []
  #operators: array:26 [▶]
  #useWritePdo: false
}

我想显示数据应该如何从这种情况中访问数据。

0 个答案:

没有答案