我一直在试图弄清楚为什么会这样!我使用了laravel内置的身份验证方法,我的laravel版本是5.7,数据库是Mysql。问题是当我尝试登录时,服务器没有任何反应,否则,注册过程可以正常工作。我必须提到当我将这些代码与通过迁移构建的另一个数据库一起使用时,一切都进行得很好。这是我的模型:
<?php
namespace App;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
protected $table = 'person';
use Notifiable;
protected $guarded= [];
}
这是我的登录控制器:
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
class LoginController extends Controller
{
use AuthenticatesUsers;
/**
* Where to redirect users after login.
*
* @var string
*/
protected $redirectTo = '/';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest')->except('logout');
}
public function username()
{
return 'username';
}
}
路由器
<?php
Auth::routes();
Route::get('/', 'HomeController@index')->name('indexPage');
Route::get('/contact-us', 'ContactUsController@index')->name('contactPage');
Route::get('/about-us', function(){return view('pages.AboutUs');})->name('aboutPage');
Route::resource('/brands' , 'brandController');