Php 更新时调用undefined方法Illumb\Auth\GenericUser::fill()::时
我想更新用户密码 这是我的职责:Php 更新时调用undefined方法Illumb\Auth\GenericUser::fill()::时,php,database,laravel,laravel-5,Php,Database,Laravel,Laravel 5,我想更新用户密码 这是我的职责: public function modifiermdp(Request $request) { $userupdate = Auth::user(); $password = bcrypt($request['password']); $userupdate->fill(['password' => $password])->save(); return Redirect::back()->with('me
public function modifiermdp(Request $request)
{
$userupdate = Auth::user();
$password = bcrypt($request['password']);
$userupdate->fill(['password' => $password])->save();
return Redirect::back()->with('message', 'تم التعديل بنجاح');
}
这是我的路线:
Route::prefix('/compte')->group(function() {
Route::get('/', 'CompteController@index');
Route::post('/changemdp', 'CompteController@modifiermdp');
});
我在config/auth.php中使用数据库驱动程序
'providers' => [
'enseignant' => [
'driver' => 'database',
'table' => 'enseignant',
],
],
我得到这个错误
CompteController.php第38行中的FatalErrorException:
调用未定义的方法Illumb\Auth\GenericUser::fill()
因为它是一个数据库驱动程序,所以必须手动执行
\DB::table('enseignant')
->where('id', $user->getAuthIdentifier())
->update(['password' => $password]);
对undefined方法Illumb\Auth\GenericUser::forceFill()的相同错误调用相同错误GenericUser::save()当我使用dd($userupdate)时,我得到了正确的信息GenericUser{403▼ #属性:数组:21[▼ “id”=>1“password”=>“$2y$10$tWMBS0VEwt7gz.dmT1EHCOolV0lSFqn5dh2.ywjoremcvnh89dq”]}@cherire刚刚检查了类及其实现。看起来当涉及到数据库驱动程序时,您必须手动执行此操作。这是数据库驱动程序用户类
公共函数updateRememberToken(UserContract$user,$token){$This->conn->table($This->table)->where('id',$user->getAuthIdentifier())->update(['memory_token'=>$token])}
谢谢:)我以前不知道,很好