我在laravel 5中工作并且遇到了身份验证登录问题。laravel 5.1验证尝试登录验证码
我无法登录(使用正确的用户和密码),并重新导向到“登录”页面,而不是我想要的页面。
我在phpmyadmin中的表被称为“用户”,所以使用Auth是正确的。
它为什么不起作用?
<?php namespace App\Http\Controllers;
use Auth;
// product é a pasta e o index é a pagina
class BackendControlador extends Controller {
public function index() {
$email = 'email';
$password = 'password';
if (Auth::attempt(['email' => $email, 'password' => $password, 'acesso' => 1])) {
return redirect()->intended('backend/dashboard.index');
} elseif (Auth::attempt(['email'=> $email, 'password' => $password, 'acesso' => 0])) {
return redirect()->intended('welcome');
} else {
return view('auth/login');
}
}
public function portfolio() {
return view('backend/portfolio.index');
}
}
我的路线代码:
Route::get('/', function() {
return view('welcome');
});
Route::get('backend','[email protected]');
Route::get('backend/portfolio','[email protected]');
// Authentication routes...
Route::get('auth/login', 'Auth\[email protected]');
Route::post('auth/login', 'Auth\[email protected]');
// Authentication routes...
Route::get('auth/logout', 'Auth\[email protected]');
// Registration routes...
Route::get('auth/register', 'Auth\[email protected]');
Route::post('auth/register', 'Auth\[email protected]');
请张贴您的routes.php – davejal
你能标记这个问题的答案? – davejal