2017-06-05 49 views
2

我想更新用戶密碼調用未定義的方法照亮身份驗證 GenericUser ::填寫()::當更新

這是我的函數:

public function modifiermdp(Request $request) 
{ 
    $userupdate = Auth::user(); 
    $password = bcrypt($request['password']); 
    $userupdate->fill(['password' => $password])->save(); 
    return Redirect::back()->with('message', 'تم التعديل بنجاح'); 
} 

這是我的路線:

而且我使用的數據庫驅動程序中的config/auth.php

'providers' => [ 
    'enseignant' => [ 
     'driver' => 'database', 
     'table' => 'enseignant', 
    ], 
], 

我得到CompteController.php行38這個錯誤

FatalErrorException: 調用未定義的方法照亮\身份驗證\ GenericUser ::填寫()

回答

1

因爲它是一個數據庫驅動程序,你必須手動做。

\DB::table('enseignant') 
    ->where('id', $user->getAuthIdentifier()) 
    ->update(['password' => $password]); 
+0

同樣的錯誤 調用未定義的方法照亮\身份驗證\ GenericUser :: forceFill() – acharmat

+0

@cherire更新的標準雄辯的語言即可。 – Sandeesh

+0

同樣的錯誤GenericUser ::保存() 當我用dd($ userupdate) 我得到正確的信息 GenericUser {#403▼ #attributes:陣列:21 [▼ 「ID」=> 1 「密碼「=>」$ 2y $ 10 $ tWMBS0VEwt7gz.dmT1EHCOolV0lSFqn5dh2.YWJoReMcVNhnH89Dq「 ] } – acharmat

相關問題