mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-03 14:10:57 +08:00
add event user_updated
This commit is contained in:
@@ -10,6 +10,7 @@ use App\Events\UserCreated;
|
||||
use App\Events\UserDestroyed;
|
||||
use App\Events\UserDisabled;
|
||||
use App\Events\UserEnabled;
|
||||
use App\Events\UserUpdated;
|
||||
use App\Models\News;
|
||||
use App\Models\Torrent;
|
||||
use App\Models\User;
|
||||
@@ -43,6 +44,7 @@ class FireEvent extends Command
|
||||
"user_destroyed" => ['event' => UserDestroyed::class, 'model' => User::class],
|
||||
"user_disabled" => ['event' => UserDisabled::class, 'model' => User::class],
|
||||
"user_enabled" => ['event' => UserEnabled::class, 'model' => User::class],
|
||||
"user_updated" => ['event' => UserUpdated::class, 'model' => User::class],
|
||||
|
||||
"news_created" => ['event' => NewsCreated::class, 'model' => News::class],
|
||||
];
|
||||
|
||||
39
app/Events/UserUpdated.php
Normal file
39
app/Events/UserUpdated.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Broadcasting\Channel;
|
||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
use Illuminate\Broadcasting\PresenceChannel;
|
||||
use Illuminate\Broadcasting\PrivateChannel;
|
||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class UserUpdated
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
|
||||
public ?Model $model = null;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Model $model)
|
||||
{
|
||||
$this->model = $model;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the channels the event should broadcast on.
|
||||
*
|
||||
* @return \Illuminate\Broadcasting\Channel|array
|
||||
*/
|
||||
public function broadcastOn()
|
||||
{
|
||||
return new PrivateChannel('channel-name');
|
||||
}
|
||||
}
|
||||
@@ -1070,6 +1070,10 @@ function clear_user_cache($uid, $passkey = '')
|
||||
if ($passkey) {
|
||||
\Nexus\Database\NexusDB::cache_del('user_passkey_'.$passkey.'_content');//announce.php
|
||||
}
|
||||
$userInfo = \App\Models\User::query()->find($uid, \App\Models\User::$commonFields);
|
||||
if ($userInfo) {
|
||||
fire_event("user_updated", $userInfo);
|
||||
}
|
||||
}
|
||||
|
||||
function clear_setting_cache()
|
||||
|
||||
Reference in New Issue
Block a user