2023-11-17 14:44:01 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Providers;
|
|
|
|
|
|
2025-06-22 01:18:38 +08:00
|
|
|
use App\Models\User;
|
|
|
|
|
use App\Observers\UserObserver;
|
2023-11-17 14:44:01 +08:00
|
|
|
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
|
|
|
|
use Illuminate\Support\Facades\Event;
|
|
|
|
|
|
|
|
|
|
class EventServiceProvider extends ServiceProvider
|
|
|
|
|
{
|
|
|
|
|
/**
|
2025-05-07 19:48:19 +08:00
|
|
|
* 事件监听器映射
|
|
|
|
|
* @var array<string, array<int, class-string>>
|
2023-11-17 14:44:01 +08:00
|
|
|
*/
|
|
|
|
|
protected $listen = [
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
/**
|
2025-05-07 19:48:19 +08:00
|
|
|
* 注册任何事件
|
2023-11-17 14:44:01 +08:00
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
public function boot()
|
|
|
|
|
{
|
|
|
|
|
parent::boot();
|
|
|
|
|
|
2025-06-22 01:18:38 +08:00
|
|
|
// 注册用户模型观察者
|
|
|
|
|
User::observe(UserObserver::class);
|
2023-11-17 14:44:01 +08:00
|
|
|
}
|
|
|
|
|
}
|