本文整理汇总了PHP中Yajra\Datatables\Datatables::usingQueryBuilder方法的典型用法代码示例。如果您正苦于以下问题:PHP Datatables::usingQueryBuilder方法的具体用法?PHP Datatables::usingQueryBuilder怎么用?PHP Datatables::usingQueryBuilder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Yajra\Datatables\Datatables
的用法示例。
在下文中一共展示了Datatables::usingQueryBuilder方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_datatables_make_with_data_and_uses_mdata
public function test_datatables_make_with_data_and_uses_mdata()
{
$builder = $this->setupBuilder();
// set Input variables
$this->setupInputVariables();
$datatables = new Datatables(Request::capture());
$response = $datatables->usingQueryBuilder($builder)->make(true);
$actual = $response->getContent();
$expected = '{"draw":1,"recordsTotal":2,"recordsFiltered":2,"data":[{"id":1,"name":"foo"},{"id":2,"name":"bar"}]}';
$this->assertInstanceOf('Illuminate\\Http\\JsonResponse', $response);
$this->assertEquals($expected, $actual);
}
示例2: usingQueryBuilder
/**
* Datatables using Query Builder.
*
* @param \Illuminate\Database\Query\Builder $builder
* @return \Yajra\Datatables\Engines\QueryBuilderEngine
* @static
*/
public static function usingQueryBuilder($builder)
{
return \Yajra\Datatables\Datatables::usingQueryBuilder($builder);
}