我在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