Laravel如何从UserController调用受保护的函数fireOtherDeviceLogoutEvent()



在Illuminate/Auth/SessionGuard.php中有一个方法fireOtherDeviceLogoutEvent($user).

我想从我的UserController中调用它。

最好的方法是什么?

我认为你可以写一个新的函数并在控制器中调用它。

我希望它能帮助你。

use IlluminateAuthEventsOtherDeviceLogout;
protected function fireOtherDeviceLogoutEvent()
{
$name = Auth::getName();
$user = Auth::user();
event(new OtherDeviceLogout($name, $user));
}

最新更新