欢迎各位兄弟 发布技术文章
这里的技术是共享的
先添加国内镜像
composer config -g repo.packagist composer https://packagist.phpcomposer.com
进到项目目录执行如下命令
composer create-project laravel/laravel --prefer-dist obj_laravel
php -S localhost:80 -t obj_laravel/public
相关操作命令
#创建控制器
php artisan make:controller MyController
php artisan make:controller PhotoController --resource
#显示路由
php artisan route:list
#生成模型
php artisan make:model User
#数据迁移
php artisan make:migration create_users_table
#运行迁移
php artisan migrate
#数据填充
php artisan make:seeder UserTableSeeder
#运行填充器
php artisan db:seedphp artisan db:seed --class=UserTableSeeder
#回滚并重新运行迁移
php artisan migrate:refresh --seed
composer require barryvdh/laravel-debugbar
#line:124~160左右
Barryvdh\Debugbar\ServiceProvider::class,
#config/app.php中添加如下门面别名到 aliases数组:
'Debugbar' => Barryvdh\Debugbar\Facade::class,
#然后运行如下 Artisan 命令将该扩展包的配置文件拷贝到 config目录下:
php artisan vendor:publish
Debugbar::info($object);Debugbar::error('Error!');
Debugbar::warning('Watch out…');
Debugbar::addMessage('Another message', 'mylabel');
Debugbar::startMeasure('render','Time for rendering');
Debugbar::stopMeasure('render');
Debugbar::addMeasure('now', LARAVEL_START, microtime(true));
Debugbar::measure('My long operation', function() { // Do something…});
try {
throw new Exception('foobar');
} catch (Exception $e) {
Debugbar::addException($e);
}
// All arguments will be dumped as a debug message
debug($var1, $someString, $intValue, $object);
start_measure('render','Time for rendering');
stop_measure('render');
add_measure('now', LARAVEL_START, microtime(true));
measure('My long operation', function() {
// Do something…
});
Debugbar::addCollector(new DebugBar\DataCollector\MessagesCollector('my_messages'));
$debugbar = App::make('debugbar');
$debugbar->addCollector(new DebugBar\DataCollector\MessagesCollector('my_messages'));
$renderer = Debugbar::getJavascriptRenderer();
注意:使用自动注入的话将会禁止显示 Request 信息,因为在响应之后才会添加该信息。你可以通过在配置文件中添加 default_request数据收集器作为替换方案。
\Debugbar::enable();\Debugbar::disable();