| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- <?php
- namespace App\Module\Point\Providers;
- use Illuminate\Support\ServiceProvider;
- use Illuminate\Support\Facades\Event;
- use App\Module\Farm\Events\CropPlantedEvent;
- use App\Module\Point\Listeners\PlantingPointsListener;
- /**
- * 积分模块服务提供者
- *
- * 负责注册积分模块的服务、配置和路由
- */
- class PointServiceProvider extends ServiceProvider
- {
- /**
- * 注册服务
- *
- * @return void
- */
- public function register()
- {
- }
- /**
- * 启动服务
- *
- * @return void
- */
- public function boot()
- {
- // 注册事件监听器
- $this->registerEventListeners();
- }
- /**
- * 注册事件监听器
- *
- * @return void
- */
- protected function registerEventListeners()
- {
- // 监听作物种植事件,自动增加种植点数
- Event::listen(CropPlantedEvent::class, PlantingPointsListener::class);
- }
- }
|