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


PHP DB::enableQueryLog方法代码示例

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


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

示例1: __construct

 /**
  * @param Application $application
  */
 public function __construct(Application $application)
 {
     $this->application = $application;
     $this->makeModel();
     $this->makeValidator();
     $this->makePresenter();
     if ($this->isDebug()) {
         DB::enableQueryLog();
     }
 }
开发者ID:mayconbordin,项目名称:reloquent,代码行数:13,代码来源:BaseRepository.php

示例2: obtenerVentasPendientes

 public function obtenerVentasPendientes(VentasPendientesRequest $request)
 {
     $usuario = User::find($this->user_auth->id);
     $oficinas = array();
     foreach ($usuario->plazas as $plazas) {
         array_push($oficinas, $plazas->Oficina);
     }
     DB::enableQueryLog();
     $ventasPendientes = DB::table('contabilidad_sales')->select('*', DB::raw('SUM(ammount) as ammount, SUM(ammount_applied) as ammount_applied '))->whereRaw('credit_debit = ? and reference = ? ', ['credit', $request->get('referencia')])->groupBy('reference')->get();
     $items['items'] = $ventasPendientes;
     return response()->json($items);
 }
开发者ID:gitfreengers,项目名称:larus,代码行数:12,代码来源:SalesController.php

示例3:

 /**
  * @param CachingRepositoryInterface $repository
  */
 function check_caching_repository_caching(CachingRepositoryInterface $repository)
 {
     DB::enableQueryLog();
     $this->assertCount(8, $repository->inProgress()->get());
     $this->assertCount(10, $repository->completed()->get());
     $this->assertCount(2, DB::getQueryLog());
     $this->assertCount(8, $repository->inProgress()->get());
     $this->assertCount(10, $repository->completed()->get());
     $this->assertCount(2, DB::getQueryLog());
     $this->assertCount(18, $repository->all());
     $this->assertCount(3, DB::getQueryLog());
     $this->assertCount(18, $repository->all());
     $this->assertCount(3, DB::getQueryLog());
     DB::disableQueryLog();
     \Cache::flush();
 }
开发者ID:logaretm,项目名称:depo,代码行数:19,代码来源:CachingRepositoryTest.php

示例4: register

 public function register()
 {
     if (env('APP_ENV') === 'local') {
         DB::enableQueryLog();
     }
     $this->app->singleton('Infrastructure\\TenantScope\\TenantScope', function ($app) {
         return new TenantScope();
     });
     $this->app->bind(SendingProvider::class, function () {
         switch (env('SMS_GATEWAY_DRIVER')) {
             case 'clickatell':
             default:
                 return new ClickatellSendingProvider(env('SMS_GATEWAY_USER'), env('SMS_GATEWAY_PASS'), env('SMS_GATEWAY_API_ID'));
                 break;
         }
     });
 }
开发者ID:etiennemarais,项目名称:legit,代码行数:17,代码来源:AppServiceProvider.php

示例5: index

 public function index()
 {
     if (Sentinel::check()) {
         if (Sentinel::hasAccess('pendientes.view')) {
             $usuario = User::find($this->user_auth->id);
             $oficinas = array();
             foreach ($usuario->plazas as $plazas) {
                 array_push($oficinas, $plazas->Oficina);
             }
             DB::enableQueryLog();
             $ventasPendientes = Sales::select('*', DB::raw('SUM(ammount) as ammount, SUM(ammount_applied) as ammount_applied '))->whereRaw('credit_debit = ?  ', ['credit'])->groupBy('reference')->get();
             return view('contabilidad::Earrings.index', compact("ventasPendientes"));
         } else {
             alert()->error('No tiene permisos para acceder a esta area.', 'Oops!')->persistent('Cerrar');
             return back();
         }
     } else {
         return redirect('login');
     }
 }
开发者ID:gitfreengers,项目名称:larus,代码行数:20,代码来源:EarringsController.php

示例6: frontend

 public function frontend()
 {
     if (isset($_GET['debug'])) {
         if ($this->app->make('config')->get('app.debug')) {
             DB::enableQueryLog();
         }
     }
     event_trigger('mw.controller.index');
     if ($this->render_this_url == false and $this->app->url_manager->is_ajax() == false) {
         $page_url = $this->app->url_manager->string();
     } elseif ($this->render_this_url == false and $this->app->url_manager->is_ajax() == true) {
         $page_url = $this->app->url_manager->string(1);
     } else {
         $page_url = $this->render_this_url;
         $this->render_this_url = false;
     }
     if ($this->page_url != false) {
         $page_url = $this->page_url;
     }
     if (strtolower($page_url) == 'index.php') {
         $page_url = '';
     }
     if ($this->create_new_page == true and $this->page_url != false) {
         $page_url = $this->page_url;
     }
     $page = false;
     if ($page == false and !empty($this->page)) {
         $page = $this->page;
     }
     $page_url = rtrim($page_url, '/');
     $is_admin = $this->app->user_manager->is_admin();
     $page_url_orig = $page_url;
     $simply_a_file = false;
     $show_404_to_non_admin = false;
     // if this is a file path it will load it
     if (isset($_REQUEST['view'])) {
         $is_custom_view = $_REQUEST['view'];
     } else {
         $is_custom_view = $this->app->url_manager->param('view');
         if ($is_custom_view and $is_custom_view != false) {
             $is_custom_view = str_replace('..', '', $is_custom_view);
             $page_url = $this->app->url_manager->param_unset('view', $page_url);
         }
     }
     $is_editmode = $this->app->url_manager->param('editmode');
     $is_no_editmode = $this->app->url_manager->param('no_editmode');
     $is_quick_edit = $this->app->url_manager->param('mw_quick_edit');
     if ($is_quick_edit != false) {
         $page_url = $this->app->url_manager->param_unset('mw_quick_edit', $page_url);
     }
     $is_preview_template = $this->app->url_manager->param('preview_template');
     if (!$is_preview_template) {
         $is_preview_template = false;
         if ($this->return_data == false) {
             if (!defined('MW_FRONTEND')) {
                 define('MW_FRONTEND', true);
             }
         }
         if (mw()->user_manager->session_id() and $is_editmode and $is_no_editmode == false) {
             if ($is_editmode == 'n') {
                 $is_editmode = false;
                 $page_url = $this->app->url_manager->param_unset('editmode', $page_url);
                 $this->app->user_manager->session_set('back_to_editmode', true);
                 $this->app->user_manager->session_set('editmode', false);
                 return $this->app->url_manager->redirect($this->app->url_manager->site_url($page_url));
             } else {
                 $editmode_sess = $this->app->user_manager->session_get('editmode');
                 $page_url = $this->app->url_manager->param_unset('editmode', $page_url);
                 if ($is_admin == true) {
                     if ($editmode_sess == false) {
                         $this->app->user_manager->session_set('editmode', true);
                         $this->app->user_manager->session_set('back_to_editmode', false);
                         $is_editmode = false;
                     }
                     return $this->app->url_manager->redirect($this->app->url_manager->site_url($page_url));
                 } else {
                     $is_editmode = false;
                 }
             }
         }
         if (mw()->user_manager->session_id() and !$is_no_editmode) {
             $is_editmode = $this->app->user_manager->session_get('editmode');
         } else {
             $is_editmode = false;
             $page_url = $this->app->url_manager->param_unset('no_editmode', $page_url);
         }
     } else {
         $is_editmode = false;
         $page_url = $this->app->url_manager->param_unset('preview_template', $page_url);
     }
     if ($is_quick_edit == true) {
         $is_editmode = true;
     }
     $preview_module = false;
     $preview_module_template = false;
     $preview_module_id = false;
     $template_relative_layout_file_from_url = false;
     $is_preview_module = $this->app->url_manager->param('preview_module');
     if ($is_preview_module != false) {
         if ($this->app->user_manager->is_admin()) {
//.........这里部分代码省略.........
开发者ID:microweber,项目名称:microweber,代码行数:101,代码来源:DefaultController.php

示例7: saveIngredients

 /**
  * Creates all recipe ingredients
  *
  * @param Request $request
  * @param int|string $recipeId
  */
 private function saveIngredients(Request $request, $recipeId)
 {
     foreach ($request->get('ingredient') as $ingredient) {
         if (!$request->exists('amount-' . $ingredient)) {
             continue;
         }
         // creates new recipe ingredients
         if (is_numeric($ingredient)) {
             if (Ingredient::exists($ingredient) === false) {
                 continue;
             }
             if ($request->exists('updateIngredient')) {
                 DB::enableQueryLog();
                 if (in_array($ingredient, $request->get('updateIngredient'))) {
                     $recipeIngredient = RecipeIngredient::where(function ($query) use($recipeId, $ingredient) {
                         $query->where('recipe_id', '=', $recipeId)->where('ingredient_id', '=', $ingredient);
                     })->first();
                     $recipeIngredient->amount = $request->get('amount-' . $ingredient);
                     $recipeIngredient->save();
                     continue;
                 }
             }
             $recipeIngredient = new RecipeIngredient();
             $recipeIngredient->recipe_id = $recipeId;
             $recipeIngredient->ingredient_id = $ingredient;
             $recipeIngredient->amount = $request->get('amount-' . $ingredient);
             $recipeIngredient->save();
         } else {
             $newIngredient = new Ingredient();
             $newIngredient->name = ucfirst(str_replace('-', ' ', $ingredient));
             if ($newIngredient->save()) {
                 $recipeIngredient = new RecipeIngredient();
                 $recipeIngredient->recipe_id = $recipeId;
                 $recipeIngredient->ingredient_id = $newIngredient->id;
                 $recipeIngredient->amount = $request->get('amount-' . $ingredient);
                 $recipeIngredient->save();
             }
         }
     }
 }
开发者ID:tomsnuvv,项目名称:food,代码行数:46,代码来源:RecipesController.php

示例8: review

 public function review(Request $request)
 {
     $requirement_id = $request->segment(2);
     $requirement = Requirements::find($requirement_id);
     $project = Projects::find($requirement->project_id);
     DB::enableQueryLog();
     $context = ContextScenarioUserAppInteraction::leftJoin('users', 'users.id', '=', 'context_scenario_user_app_interaction.user_id')->leftJoin('context_scenario_ideal_way AS context', 'context.id', '=', 'context_scenario_user_app_interaction.context_id')->leftJoin('context_ratings as CR', 'CR.context_id', '=', 'context_scenario_user_app_interaction.id')->select('context_scenario_user_app_interaction.*', 'users.name AS user_name', 'context.context_name', 'context.full_name', DB::raw('avg(CR.rating) AS avg_rating,
                     count(CR.id) AS rating_count'))->where('requirement_id', $requirement_id)->groupBy('context_scenario_user_app_interaction.id')->get()->toArray();
     $context_voting = ContextScenarioUserAppInteraction::leftJoin('ways_of_interaction_voting as WOIV', 'WOIV.context_id', '=', 'context_scenario_user_app_interaction.id')->select('context_scenario_user_app_interaction.id', DB::raw('sum(WOIV.accompanying) as accompanying_count,
                     sum(WOIV.intermittent) as intermittent_count,
                     sum(WOIV.interrupting) as interrupting_count'))->where('requirement_id', $requirement_id)->groupBy('context_scenario_user_app_interaction.id')->get()->toArray();
     foreach ($context as &$value1) {
         foreach ($context_voting as $value2) {
             if ($value1['id'] == $value2['id']) {
                 $value1 = array_merge($value1, $value2);
             }
         }
     }
     usort($context, function ($i, $j) {
         $a = $i['avg_rating'];
         $b = $j['avg_rating'];
         if ($a == $b) {
             return 0;
         } elseif ($a > $b) {
             return 1;
         } else {
             return -1;
         }
     });
     $context = array_reverse($context);
     $breadcrumbs = array('Projects' => '/projects', 'All Requirements' => "/projects/{$requirement->project_id}");
     return view('requirements.review', compact('requirement', 'context', 'project', 'breadcrumbs'));
 }
开发者ID:biswaupreti,项目名称:MobilityRequirements,代码行数:33,代码来源:RequirementsController.php

示例9: function

<?php

use Illuminate\Support\Facades\DB;
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
DB::enableQueryLog();
/*
 * admin routes
 */
Route::group(['namespace' => 'Admin', 'middleware' => ['auth', 'admin']], function () {
    // Controllers Within The "App\Http\Controllers\Admin" Namespace
    Route::get('/admin', 'AdminController@dashboard');
    //Locations
    Route::get('/admin/location', 'LocationController@index');
    Route::any('/admin/location/edit/{id?}', 'LocationController@edit');
    Route::any('/admin/location/delete/{id?}', 'LocationController@delete');
    Route::any('/admin/location/import', 'LocationController@import');
    //Categories
    Route::get('/admin/category', 'CategoryController@index');
    Route::any('/admin/category/edit/{id?}', 'CategoryController@edit');
    Route::any('/admin/category/delete/{id?}', 'CategoryController@delete');
    Route::any('/admin/category/import', 'CategoryController@import');
    //Ads
开发者ID:gdinko,项目名称:dclassifieds.laravel,代码行数:31,代码来源:routes.php


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