diff --git a/app/Http/Controllers/PurchaseController.php b/app/Http/Controllers/PurchaseController.php index 0908c64..fe0195d 100644 --- a/app/Http/Controllers/PurchaseController.php +++ b/app/Http/Controllers/PurchaseController.php @@ -33,6 +33,8 @@ public function index(Request $request) $t=$request->input('t')==0 ? 2 : intval($request->input('t')); + $t = $request->t==0 ? 2 : intval($request->t); + // dd($request->t); // $class_list=M('pms_class')->where('is_del=0')->order('sort asc')->select(); $class_list = DB::table('pms_class')->where('is_del','0')->orderBy('sort', 'asc')->get(); $class_list = objectToArray($class_list); @@ -64,7 +66,6 @@ public function index(Request $request) // $this->assign('attr_list',$attr_list); // $this->display(); return view('purchase/index',['title'=>$title,'t'=>$t,'class_name'=>$class_name,'class_list'=>$cl,'attr_list'=>$attr_list,'no_include'=>$no_include]); - } diff --git a/composer.json b/composer.json index c30ca51..73f7657 100644 --- a/composer.json +++ b/composer.json @@ -6,6 +6,7 @@ "type": "project", "require": { "php": ">=5.6.4", + "barryvdh/laravel-debugbar": "^2.4", "encore/laravel-admin": "1.3.x-dev", "laravel/framework": "5.3.*" }, diff --git a/composer.lock b/composer.lock index 0ac255c..c54da36 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,57 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "2817952e6cb505d5470c2b3eb19dc76d", + "content-hash": "b2f7e507f665a39ed7ae508deb7fe804", "packages": [ + { + "name": "barryvdh/laravel-debugbar", + "version": "v2.4.3", + "source": { + "type": "git", + "url": "https://github.com/barryvdh/laravel-debugbar.git", + "reference": "d7c88f08131f6404cb714f3f6cf0642f6afa3903" + }, + "dist": { + "type": "zip", + "url": "https://files.phpcomposer.com/files/barryvdh/laravel-debugbar/d7c88f08131f6404cb714f3f6cf0642f6afa3903.zip", + "reference": "d7c88f08131f6404cb714f3f6cf0642f6afa3903", + "shasum": "" + }, + "require": { + "illuminate/support": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*", + "maximebf/debugbar": "~1.13.0", + "php": ">=5.5.9", + "symfony/finder": "~2.7|~3.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Barryvdh\\Debugbar\\": "src/" + }, + "files": [ + "src/helpers.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Barry vd. Heuvel", + "email": "barryvdh@gmail.com" + } + ], + "description": "PHP Debugbar integration for Laravel", + "keywords": [ + "debug", + "debugbar", + "laravel", + "profiler", + "webprofiler" + ], + "time": "2017-07-21T11:56:48+00:00" + }, { "name": "classpreloader/classpreloader", "version": "3.1.0", @@ -576,6 +625,67 @@ ], "time": "2017-08-06T17:41:04+00:00" }, + { + "name": "maximebf/debugbar", + "version": "1.13.1", + "source": { + "type": "git", + "url": "https://github.com/maximebf/php-debugbar.git", + "reference": "afee79a236348e39a44cb837106b7c5b4897ac2a" + }, + "dist": { + "type": "zip", + "url": "https://files.phpcomposer.com/files/maximebf/php-debugbar/afee79a236348e39a44cb837106b7c5b4897ac2a.zip", + "reference": "afee79a236348e39a44cb837106b7c5b4897ac2a", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "psr/log": "^1.0", + "symfony/var-dumper": "^2.6|^3.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0|^5.0" + }, + "suggest": { + "kriswallsmith/assetic": "The best way to manage assets", + "monolog/monolog": "Log using Monolog", + "predis/predis": "Redis storage" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.13-dev" + } + }, + "autoload": { + "psr-4": { + "DebugBar\\": "src/DebugBar/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Maxime Bouroumeau-Fuseau", + "email": "maxime.bouroumeau@gmail.com", + "homepage": "http://maximebf.com" + }, + { + "name": "Barry vd. Heuvel", + "email": "barryvdh@gmail.com" + } + ], + "description": "Debug bar in the browser for php application", + "homepage": "https://github.com/maximebf/php-debugbar", + "keywords": [ + "debug", + "debugbar" + ], + "time": "2017-01-05T08:46:19+00:00" + }, { "name": "monolog/monolog", "version": "1.23.0", diff --git a/config/app.php b/config/app.php index 5ea0bbe..d9d6bc1 100644 --- a/config/app.php +++ b/config/app.php @@ -177,7 +177,8 @@ // App\Providers\BroadcastServiceProvider::class, App\Providers\EventServiceProvider::class, App\Providers\RouteServiceProvider::class, - Encore\Admin\Providers\AdminServiceProvider::class + Encore\Admin\Providers\AdminServiceProvider::class, + Barryvdh\Debugbar\ServiceProvider::class, ], diff --git a/note.txt b/note.txt index 08ba028..922a946 100644 --- a/note.txt +++ b/note.txt @@ -170,4 +170,26 @@ public function boot() { 静态文件路径使用asset('js/app.js'); -引入公共头文件@include('layouts.header') \ No newline at end of file +引入公共头文件@include('layouts.header') + +打印sql语句 + +方法一:调用vendor\laravel\framework\src\Illuminate\Database\Query的toSql方法: +$query->toSql(); + +方法二:开启DB::enableQueryLog(); + +写公共方法:getLastSql() + +打印方法dd(getLastSql()); +============================================================================== + +Laravel框架开发调试工具Laravel Debugbar使用 + +1、引入package包: + +composer require barryvdh/laravel-debugbar + +2、在config/app.php的providers中添加一行注册 + +Barryvdh\Debugbar\ServiceProvider::class, \ No newline at end of file diff --git a/resources/views/purchase/index.blade.php b/resources/views/purchase/index.blade.php index a0712e3..fcaef8f 100644 --- a/resources/views/purchase/index.blade.php +++ b/resources/views/purchase/index.blade.php @@ -158,7 +158,6 @@
-