我是Laravel的新手,我聽說登錄和註冊系統在Laravel中是默認的。但是,我無法利用它。我已經在資源/視圖/內的Auth目錄中放置了登錄和註冊視圖。Laravel身份驗證錯誤
我有這個控制器Auth/AuthController.php
:
<?php
namespace App\Http\Controllers\Auth;
use App\User;
use Validator;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ThrottlesLogins;
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;
class AuthController extends Controller
{
use AuthenticatesAndRegistersUsers, ThrottlesLogins;
private $redirectTo = '/loginpage';
public function __construct()
{
$this->middleware('guest', ['except' => 'getLogout']);
}
protected function validator(array $data)
{
return Validator::make($data, [
'name' => 'required|max:255',
'email' => 'required|email|max:255|unique:users',
'password' => 'required|confirmed|min:6',
]);
}
protected function create(array $data)
{
return User::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => bcrypt($data['password']),
]);
}
}
的航線有:
// Authentication routes...
Route::get('auth/login', 'Auth\[email protected]');
Route::post('auth/login', 'Auth\[email protected]');
Route::get('auth/logout', 'Auth\[email protected]');
// Registration routes...
Route::get('auth/register', 'Auth\[email protected]');
Route::post('auth/register', 'Auth\[email protected]');
Route::controllers([
'auth' => 'Auth\AuthController',
'password' => 'Auth\PasswordController',
]);
但我收到此錯誤:
FatalErrorException in AuthenticatesAndRegistersUsers.php line 11: A precedence rule was defined for Illuminate\Foundation\Auth\AuthenticatesUsers::getGuard but this method does not exist
你檢查了嗎? http://stackoverflow.com/questions/35065996/php-fatal-error-a-precedence-rule-was-defined-for-illuminate-foundation-auth – Musterknabe
沒有這樣的文件'compile.php' @Musterknabe – micky
您可以在您的項目目錄中嘗試在CLI中使用此命令嗎? 'php artisan清編' – Musterknabe