本文整理汇总了PHP中Illuminate\Database\Capsule\Manager::enableQueryLog方法的典型用法代码示例。如果您正苦于以下问题:PHP Manager::enableQueryLog方法的具体用法?PHP Manager::enableQueryLog怎么用?PHP Manager::enableQueryLog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Database\Capsule\Manager
的用法示例。
在下文中一共展示了Manager::enableQueryLog方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: asJsonResponse
public function asJsonResponse()
{
$data = [];
$total = $amount_displayed = 0;
if ($this->model) {
$model_name = $this->model;
if ($this->columns) {
}
$sql = $model_name::query()->select($this->columns ?: '*');
$search_info = $this->a->input('search');
if (!empty($search_info['value'])) {
foreach ($this->a->input('columns') as $index => $column) {
if ($index) {
$sql->orWhere($column['name'], 'LIKE', '%' . $search_info['value'] . '%');
} else {
$sql->where($column['name'], 'LIKE', '%' . $search_info['value'] . '%');
}
}
}
foreach ($this->a->input('order', []) as $order) {
$sql->orderBy($this->a->input('columns')[$order['col']]['name'], $order['dir']);
}
\Illuminate\Database\Capsule\Manager::enableQueryLog();
$total = $sql->count();
$sql->skip($this->a->input('start'));
$models = $sql->take($this->a->input('length'))->get();
$data = $models->toArray();
$total = $total;
$amount_displayed = count($models);
}
$data = ['aaData' => $data, 'iTotalRecords' => $total, 'iTotalDisplayRecords' => $amount_displayed];
return new JsonResponse($data, 200);
}
示例2: setUpBeforeClass
public static function setUpBeforeClass()
{
$schema = Capsule::schema();
$schema->dropIfExists('categories');
$schema->create('categories', function (\Illuminate\Database\Schema\Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->softDeletes();
NestedSet::columns($table);
});
Capsule::enableQueryLog();
}
示例3: setUpBeforeClass
public static function setUpBeforeClass()
{
$schema = Capsule::schema();
$schema->dropIfExists('menu_items');
Capsule::disableQueryLog();
$schema->create('menu_items', function (\Illuminate\Database\Schema\Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('menu_id');
$table->string('title')->nullable();
NestedSet::columns($table);
});
Capsule::enableQueryLog();
}