title: How to set custom attribute labels for nested inputs in Laravel
body: <p>I'm trying to get custom labels in the error messages. My inputs are nested and i am able to validate them using dot notation (e.g. <code>POLICY.HOLDER.NAME</code> ). They have to be nested and all caps to match the db structure so I can easily mass assign them.</p>
  
  <p>Using the same notation in <code>'attributes' =&gt; ['POLICY.HOLDER.NAME' =&gt; 'Policy Holder']</code> in <code>resources/lang/en/validation.php</code> yielded no result.</p>
  
  <p>I'm just trying to get them to match the labels i've set in the form.</p>
  
  <p>app/Http/Controllers/OfferController.php (just the interesting part)</p>
  
  <pre><code>public function postOffer(OfferRequest $request) { //
      $post_data = $request-&gt;all();
      if (isset($post_data['POLICY'])) {
          // code to get data from $_POST and assign to models
      }
  }
  </code></pre>
  
  <p>app/Http/Requests/OfferRequest.php</p>
  
  <pre><code>&lt;?php 
  namespace App\Http\Requests;
  
  use App\Http\Requests\Request, Auth;
  
  class OfertaRequest extends Request
  {
  
      public function authorize() {
          return Auth::check();
      }
  
      public function rules()
      {
          return [
              'POLICY.HOLDER.NAME' =&gt; 'required',
          ];
      }
  
      public function forbiddenResponse()
      {
          return Response::make('Permission denied foo!', 403);
      }
  
  }
  </code></pre>
  
  <p>resources/lang/en/validation.php</p>
  
  <pre><code>'attributes' =&gt; [
      'POLICY.HOLDER.NAME' =&gt; 'Some custom string here...',
  ],
  </code></pre>
  
  <p>As you can see i've tried adding the input name in the Custom Validation Attributes array with no success. Here's the error message i get when leaving the input blank:</p>
  
  <blockquote>
    <p>The p o l i c y. h o l d e r. n a m e field is required.</p>
  </blockquote>
  
  <p>Note the spaces. I've tried that too, it didn't work.</p>