本文整理匯總了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();
}