2017-07-08 17 views
0

私はLaravel 5.4をインストールし、php artisan make:authを使用しました。すべてがすべて問題なく、データベースをセットアップしてすべてを移行しました。私もログインと登録をテストし、それは完全に動作していました。BadMethodCallException - 未定義のメソッドを呼び出す Database Query Builder :: getAuthIdentifierName()

その後、私は他のコントローラとモデルをセットアップすることができました。コントローラの1つをテストした後(基本的に、データベースにイメージを格納して表示します)そして、うまくいき、画像を保存して表示しました。

しかし、それ以来、私はログインまたは登録しようとするとエラーが発生します。

私は、次のエラーが表示さhttp://localhost:8000/loginまたはhttp://localhost:8000/registerにアクセスしよう:私は共有するべき私のコードの一部で完全にわからないが、これは私のモーダルUser.phpあるこの1のために

Call to undefined method Illuminate\Database\Query\Builder::getAuthIdentifierName()

を:

namespace App; 
use Illuminate\Database\Eloquent\Model; 
use Illuminate\Notifications\Notifiable; 
use Illuminate\Foundation\Auth\User as Authenticatable; 

use App\User; 

class User extends Authenticatable 
{ 
    use Notifiable; 

    /** 
    * The attributes that are mass assignable. 
    * 
    * @var array 
    */ 


    protected $table = 'users'; 

    protected $fillable = [ 
     'name', 'email', 'password', 
    ]; 

    /** 
    * The attributes that should be hidden for arrays. 
    * 
    * @var array 
    */ 
    protected $hidden = [ 
     'password', 'remember_token', 
    ]; 
} 

は、あなたが私のコードの他の部分が必要な場合、私は共有させていただきます、事前にみんなにありがとう。

+1

はあなたのルートやコントローラファイルを共有持っていることを確認してください –

答えて

1

すべての最初の実行php artisan migrateの最初は、データベース内のテーブル

User.php // user model add a primary key to get rid of this error

protected $primaryKey = 'yourPrimaryKey'; 
関連する問題