[英]Laravel 5 ModelNotFoundException in Builder.php for Routing
[英]laravel after signup giving error in builder.php
我是Laravel的初學者。 我剛剛創建了一個新的laravel 5.4項目。 然后我跑
php artisan make:auth
之后,我嘗試注冊用戶。 現在我收到此錯誤:
ErrorException in Builder.php line 2443:
Call to undefined method Illuminate\Database\Query\Builder::getAuthIdentifierName() (View: D:\wamp\www\crud\resources\views\welcome.blade.php)
在我看來,因為錯誤來自welcome.blade.php
@if (Route::has('login'))
<div class="top-right links">
@if (Auth::check())
<a href="{{ url('/home') }}">Home</a>
@else
<a href="{{ url('/login') }}">Login</a>
<a href="{{ url('/register') }}">Register</a>
@endif
</div>
@endif
我在該文件夾內復制的用戶模型的應用程序內創建了一個Models文件夾。
<?php
namespace App\Models;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{.....
我確實在我的auth.php文件中進行了更改
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\Models\User::class,
],
誰能幫我解決我的問題。 先感謝您。
嘗試添加backslack @if (\\Auth::check())
,
或確保您的用戶模型使用Illuminate\\Auth\\Authenticatable
特征,
App\\User
更改為App\\Models\\User
),請嘗試運行composer dumpautoload
。 讓我知道是否有解決方案。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.