0
我已经试图按照documentation,但我没有成功。 我需要一个条件添加到原来的登录系统在laravel中如何个性化登录
我已经试过如下:
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Illuminate\Support\Facades\Auth;
class LoginController extends Controller
{
use AuthenticatesUsers;
protected $redirectTo = '/';
public function authenticate()
{
if (Auth::attempt(['email' => $email, 'password' => $password, 'type' => 'cliente'])) {
dd('autenticate');
}
}
}
我的路线
Route::post('/login', 'Auth\[email protected]');
的埃罗:
ErrorException: Undefined variable: email in /var/www...
不任何人都知道我可以做到这一点?
----------- -----------决议:
我不知道这是否是最安全的方式,但它的工作是这样的:
public function authenticate(Request $request)
{
$this->validateLogin($request);
$input=$request->all();
$password=$input['password'];
$email=$input['email'];
if (Auth::attempt(['email' => $email, 'password' => $password, 'type'=>'cliente'])) {
return redirect()->intended('/');
}
$this->incrementLoginAttempts($request);
return $this->sendFailedLoginResponse($request);
}
我的路线:
Route::post('/login', 'Auth\[email protected]');
向我们展示'login'函数。 – Wreigh
@Wreigh我操纵的控制器LoginController中不存在函数login;此功能位于供应商文件夹 –
内的AuthenticatesUsers类别内,错误或问题是什么?什么不工作? – Wreigh