这可能很简单,但我不明白。我希望用户登录后,程序可以在日志文件中写入内容。因此,我坚信可以通过扩展特性来发挥作用。
LoginController
uses AuthenticatesUsers
trait and the login()
is there, so the first thing I did was to add my own login()
in the LoginController, something like:
public function login(Request $request) {
$ret = parent::login($request);
// Do the writting to the log
return $ret;
}
This didn't work... so then I turned to try a postLogin()
function, but didn't work either, it simply didn't execute. This function is on the LoginController
public function postLogin() {
// Do writting to the log
}
哪种方法正确?
In
app\Http\Controllers\Auth\LoginController.php
add the following:看到
https://laravel.com/docs/7.x/authentication#included-authenticating
欲获得更多信息