php artisan vendor:publish

可以看到有这么多的项目,这里根据序号进行选择,就可以实现不同的任务。
自定义实现:
1、首先定义provider 服务提供者
2、再boot方法中,增加publishes 方法
3、通过命令查看
<?php
namespace InfyOm\Generator;
use Illuminate\Support\ServiceProvider;
class InfyOmGeneratorServiceProvider extends ServiceProvider
{
/**
* Bootstrap the application services.
*
* @return void
*/
public function boot()
{
$configPath = __DIR__.'/../config/laravel_generator.php';
$this->publishes([
$configPath => config_path('infyom/laravel_generator.php'),
]);
}
/**
* Register the application services.
*
* @return void
*/
public function register()
{
}
}

分析就分析到底,怎么又出现了Tag ? [11-19] 这又是怎么写的呢? 我们举个例子:
看看第13项 cors
public function boot()
{
if ($this->app instanceof LaravelApplication && $this->app->runningInConsole()) {
$this->publishes([$this->configPath() => config_path('cors.php')], 'cors');
} elseif ($this->app instanceof LumenApplication) {
$this->app->configure('cors');
}
}publishes()
第一个参数 数组
key是原始文件所在位置
value是要发布到的目标位置
第二个参数 groups cors
