laravel Modules插件内定时任务执行,自定义命令注册,插件内资源发布
找到Modules中模块的Provider文件夹
public function boot()
{
$this->registerTranslations();
$this->registerConfig();
$this->registerViews();
$this->registerFactories();
$this->commands([\Modules\GoogleSitemap\Console\GenerateSitemapCommand::class]);//命令注册
$this->app->booted(function () {
$schedule = $this->app->make(Schedule::class);
$schedule->command('sitemap:generate')->daily();
});//定时命令启动
$this->loadMigrationsFrom(module_path($this->moduleName, 'Database/Migrations'));
$this->publishes([
__DIR__.'/../Resources/assets/image/' => public_path('images/plugins'),
], 'public');//文件夹发布
}
本作品采用《CC 协议》,转载必须注明作者和本文链接
用过,没啥感觉,这个包挺不适合你们的业务