2016-11-14 10 views
1

mongodbで設定したlaravel 5.3新しい設定がありますが、パスワードリセットの送信時にエラーが発生しています。Carbon Dateエラー新規設定時laravel 5.3

例外221行Carbon.phpで:DateTime::__construct()パラメータ1が文字列であることを期待し、アレイは、私がconfig/app.phpに次の行を追加し、このlaravelデフォルトコード

+1

パスワードをリセットするためのコードを入手できますか? – prateekkathal

+0

$ response = $ this-> broker() - >リセット( )$ this-> credentials($ request)、function($ user、$ password){ $ this-> resetPassword($ user、$ password); } ); –

+0

ここからエラーが来ています。そして、私はこれらの行に書かれた関数の実際の定義を得ることができませんか? –

答えて

1
<?php 

namespace Illuminate\Foundation\Auth; 

use Illuminate\Support\Str; 
use Illuminate\Http\Request; 
use Illuminate\Support\Facades\Auth; 
use Illuminate\Support\Facades\Password; 

trait ResetsPasswords 
{ 
    use RedirectsUsers; 

    /** 
    * Display the password reset view for the given token. 
    * 
    * If no token is present, display the link request form. 
    * 
    * @param \Illuminate\Http\Request $request 
    * @param string|null $token 
    * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View 
    */ 
    public function showResetForm(Request $request, $token = null) 
    { 

     return view('auth.passwords.reset')->with(
      ['token' => $token, 'email' => $request->email] 
     ); 
    } 

    /** 
    * Reset the given user's password. 
    * 
    * @param \Illuminate\Http\Request $request 
    * @return \Illuminate\Http\Response 
    */ 
    public function reset(Request $request) 
    { 


     $this->validate($request, $this->rules(), $this->validationErrorMessages()); 

     // Here we will attempt to reset the user's password. If it is successful we 
     // will update the password on an actual user model and persist it to the 
     // database. Otherwise we will parse the error and return the response. 

     $response = $this->broker()->reset(
      $this->credentials($request), function ($user, $password) { 
       $this->resetPassword($user, $password); 
      } 
     ); 


     // If the password was successfully reset, we will redirect the user back to 
     // the application's home authenticated view. If there is an error we can 
     // redirect them back to where they came from with their error message. 
     return $response == Password::PASSWORD_RESET 
        ? $this->sendResetResponse($response) 
        : $this->sendResetFailedResponse($request, $response); 
    } 

    /** 
    * Get the password reset validation rules. 
    * 
    * @return array 
    */ 
    protected function rules() 
    { 
     return [ 
      'token' => 'required', 'email' => 'required|email', 
      'password' => 'required|confirmed|min:6', 
     ]; 
    } 

    /** 
    * Get the password reset validation error messages. 
    * 
    * @return array 
    */ 
    protected function validationErrorMessages() 
    { 
     return []; 
    } 

    /** 
    * Get the password reset credentials from the request. 
    * 
    * @param \Illuminate\Http\Request $request 
    * @return array 
    */ 
    protected function credentials(Request $request) 
    { 
     return $request->only(
      'email', 'password', 'password_confirmation', 'token' 
     ); 
    } 

    /** 
    * Reset the given user's password. 
    * 
    * @param \Illuminate\Contracts\Auth\CanResetPassword $user 
    * @param string $password 
    * @return void 
    */ 
    protected function resetPassword($user, $password) 
    { 
     $user->forceFill([ 
      'password' => bcrypt($password), 
      'remember_token' => Str::random(60), 
     ])->save(); 

     $this->guard()->login($user); 
    } 

    /** 
    * Get the response for a successful password reset. 
    * 
    * @param string $response 
    * @return \Illuminate\Http\Response 
    */ 
    protected function sendResetResponse($response) 
    { 
     return redirect($this->redirectPath()) 
          ->with('status', trans($response)); 
    } 

    /** 
    * Get the response for a failed password reset. 
    * 
    * @param \Illuminate\Http\Request 
    * @param string $response 
    * @return \Illuminate\Http\RedirectResponse 
    */ 
    protected function sendResetFailedResponse(Request $request, $response) 
    { 
     return redirect()->back() 
        ->withInput($request->only('email')) 
        ->withErrors(['email' => trans($response)]); 
    } 

    /** 
    * Get the broker to be used during password reset. 
    * 
    * @return \Illuminate\Contracts\Auth\PasswordBroker 
    */ 
    public function broker() 
    { 
     return Password::broker(); 
    } 

    /** 
    * Get the guard to be used during password reset. 
    * 
    * @return \Illuminate\Contracts\Auth\StatefulGuard 
    */ 
    protected function guard() 
    { 
     return Auth::guard(); 
    } 
} 

予め

おかげを与え問題を解決します:

Jenssegers\Mongodb\Auth\PasswordResetServiceProvider::class, 
0

を使用してい