コード例 #1
0
 /**
  * Message provider from which to extract failed validation messages
  *
  * @param string          $message
  * @param MessageProvider $failedProvider
  */
 public function __construct($message, MessageProvider $failedProvider = null)
 {
     if ($failedProvider) {
         $message = $message . "\r\nThe following fields have not passed validation:\r\n";
         foreach ($failedProvider->getMessageBag()->all() as $key => $text) {
             $message .= $key . ' => ' . $text . "\r\n";
         }
     }
     parent::__construct($message);
 }
コード例 #2
0
ファイル: View.php プロジェクト: uiandwe/profile
 /**
  * Add validation errors to the view.
  *
  * @param  \Illuminate\Contracts\Support\MessageProvider|array  $provider
  * @return $this
  */
 public function withErrors($provider)
 {
     if ($provider instanceof MessageProvider) {
         $this->with('errors', $provider->getMessageBag());
     } else {
         $this->with('errors', new MessageBag((array) $provider));
     }
     return $this;
 }
コード例 #3
0
 /**
  * Get the validation error message provider.
  *
  * @return \Illuminate\Contracts\Support\MessageBag
  */
 public function errors()
 {
     return $this->provider->getMessageBag();
 }
コード例 #4
0
 /**
  * Parse the given errors into an appropriate value.
  *
  * @param  \Illuminate\Contracts\Support\MessageProvider|array|string  $provider
  * @return \Illuminate\Support\MessageBag
  */
 protected function parseErrors($provider)
 {
     if ($provider instanceof MessageProvider) {
         return $provider->getMessageBag();
     }
     return new MessageBag((array) $provider);
 }
コード例 #5
0
ファイル: RedirectResponse.php プロジェクト: fluxbb/core
 public function withErrors(MessageProvider $errors)
 {
     $this->session->flash('fluxbb.errors', $errors->getMessageBag());
     return $this;
 }