<?phpnamespace App\Listeners;use Filament\Events\TenantSet;use Illuminate\Contracts\Queue\ShouldQueue;use Illuminate\Queue\InteractsWithQueue;use Illuminate\Support\Facades\Log;class UpdateLatestTeamId{ /** * Create the event listener. */ public function __construct() { // Log::info('UpdateLatestTeamId::__construct()'); } /** * Handle the event. */ public function handle(TenantSet $event): void { // get the user from the event $user = $event->getUser(); // get the tenant (team) from the event $team = $event->getTenant(); // update the user's latest_team_id $user->latest_team_id = $team->id; $user->save(); }}
<?phpnamespace App\Listeners;use Filament\Events\TenantSet;use Illuminate\Contracts\Queue\ShouldQueue;use Illuminate\Queue\InteractsWithQueue;use Illuminate\Support\Facades\Log;class UpdateLatestTeamId{ /** * Create the event listener. */ public function __construct() { // Log::info('UpdateLatestTeamId::__construct()'); } /** * Handle the event. */ public function handle(TenantSet $event): void { // get the user from the event $user = $event->getUser(); // get the tenant (team) from the event $team = $event->getTenant(); // update the user's latest_team_id $user->latest_team_id = $team->id; $user->save(); }}
And then you need to register your new listener in