文章借鉴网址:https://www.php.cn/blog/detail/31020.html
本文讲述,在phpstorm中,如何使用快捷键,把下面的代码中的字段名提取出来,放到数组的方括号中。
$table->integer('user_id')->comment('创建者');
$table->integer('category_id')->comment('分类');
$table->string('title')->comment('标题');
$table->string('description')->comment('描述');
$table->integer('price')->comment('价格');
$table->integer('stock')->comment('库存');
$table->integer('sales')->default(0)->comment('销量');
$table->string('cover')->comment('封面图');
$table->json('pics')->nullable()->comment('小图集');
$table->tinyInteger('is_on')->default(0)->comment('是否上架 0不上架 1上架');
$table->tinyInteger('is_recommend')->default(0)->comment('是否推荐 0不推荐 1推荐');
$table->text('details')->comment('详情');
最后的效果
[
'user_id',
'category_id',
'title',
'description',
'price',
'stock',
'sales',
'cover',
'pics',
'is_on',
'is_recommend',
'details',
]
操作如下:
一、把光标放到第一个$之前,按住 alt+shift,同时按住鼠标左键,向下拖动。效果如下:
二、按住shift+ctrl键,再点右向键->,随着点的次数增多,选中的范围不断扩大。直到选中每一行的第一个左括号。
三、按del键删除选中部分。
四、按ctrl键,再点右向键->,光标跳到第一个右括号前,放开ctrl键,输入逗号。
五、按住shift键,点一下end键,选中剩余的部分。
六、按del键删除选中部分