把()當我試圖通過驗證返回錯誤象下面這樣:調用未定義的方法照亮的 Support MessageBag ::在Laravel 5.3
return Redirect::back()->withErrors($validator)->withInput();
它給我這個錯誤:
Call to undefined method Illuminate\Support\MessageBag::put()
其是: vendor\laravel\framework\src\Illuminate\Http\RedirectResponse.php line 133
的代碼是:
/**
* Flash a container of errors to the session.
*
* @param \Illuminate\Contracts\Support\MessageProvider|array|string $provider
* @param string $key
* @return $this
*/
public function withErrors($provider, $key = 'default')
{
$value = $this->parseErrors($provider);
$this->session->flash(
'errors', $this->session->get('errors', new ViewErrorBag)->put($key, $value)
);
return $this;
}
當你看到它應該使用put方法從ViewErrorBag不MessageBag!
任何幫助,將不勝感激...