简体   繁体   English

使用Auth :: loginUsingId()进入Laravel时出现错误

[英]Got an Erro while use Auth::loginUsingId() into laravel

in registration form,when i am fetch data from HTML form and save data into database and then login into the system using Auth::loginUsingId($staff->id); 在注册表单中,当我从HTML表单中获取数据并将数据保存到数据库中,然后使用Auth :: loginUsingId($ staff-> id)登录到系统时; then following error occur. 然后发生以下错误。 can anyone help?? 有人可以帮忙吗?

Argument 1 passed to Illuminate\Auth\Guard::login() must implement interface 
Illuminate\Auth\UserInterface, null given, called in 
/var/www/doctodoor2014/vendor/laravel/framework/src/Illuminate/Auth/Guard.php 

This method needs a user id as an argument. 此方法需要一个用户ID作为参数。 Are you sure that $staff->id is giving you just an integer (user id)? 您确定$staff->id仅给您一个整数(用户ID)吗? Try to var_dump($staff->id); 尝试var_dump($staff->id); , or dd($staff->id); dd($staff->id); , ( http://laravel.com/api/function-dd.html ) to see what you are getting back. ,( http://laravel.com/api/function-dd.html )来查看您返回的内容。

Auth::loginUsingId(1);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM