title: Laravel how to display validation errors messages to the user
body: <p>In Laravel validation it just returns the errors like this</p>
  <p><a href="https://i.stack.imgur.com/8Wwh6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8Wwh6.png" alt="The Error" /></a></p>
  <p>I need to display user friendly errors</p>
  <p>the function</p>
  <pre><code>public function handleRegister(Request $request)
  {
      $validator = Validator::make($request-&gt;all(), [
          'name' =&gt; 'required|string|max:100|min:3',
          'email' =&gt; 'required|email',
          'phone' =&gt; 'required|regex:/^01[0125][0-9]{8}$/',
          'password' =&gt; 'required|string|max:100|min:8'
      ]);
  
      if ($validator-&gt;fails()) {
          return redirect()-&gt;back()
              -&gt;with('errorForm', $validator-&gt;errors()-&gt;getMessages())
              -&gt;withInput();
      }
  
      try {
          User::create(['name' =&gt; $request-&gt;name, 'email' =&gt; $request-&gt;email, 'phone' =&gt; $request-&gt;phone, 'password' =&gt; Hash::make($request-&gt;password)]);
  
          return redirect()-&gt;back()
              -&gt;with('success', 'Created successfully!');
      } catch (\Exception $e) {
          return redirect()-&gt;back()
              -&gt;with('error', 'Error during the creation!');
      }
  
      return redirect(route('home'));
  }
  </code></pre>