Laravel Validation custom messages using nested attributes
<p>I would like to ask for some advices about Laravel Validation...</p>

<p>Let's say I've got an input named <code>invoiceAddress[name]</code> and in a controller I've got a rule</p>

<pre><code>$rule = ['invoiceAddress.name' =&gt; 'required',];
</code></pre>

<p>or just a</p>

<pre><code>$validator = \Validator::make($request-&gt;all(), [
    'invoiceAddress.name' =&gt; 'required',
]);
</code></pre>

<p>now, inside custom validation language file <code>validation.php</code>, am I able to nest attributes somehow? like:</p>

<pre><code>'required' =&gt; ':attribute is mandatory',

'attributes' =&gt; [
    'invoiceAddress' =&gt; [
        'name' =&gt; 'blahblah'
    ],
],
</code></pre>

<p>If I try to nest the attribute the way above, i get</p>

<pre><code>ErrorException
    mb_strtoupper() expects parameter 1 to be string, array given
</code></pre>

<p>because I am using a field (as above)</p>

<pre><code>['name' =&gt; 'blahblah']
</code></pre>

<p>I am trying to get custom messages using the file and the <code>:attribute</code> directive (as mentioned in the code above).</p>

<p>I am basically trying to do this <a href="https://stackoverflow.com/questions/32761230/how-to-set-custom-attribute-labels-for-nested-inputs-in-laravel">How to set custom attribute labels for nested inputs in Laravel</a> but i get the mentioned error...</p>

<p>Thank you in advance...</p>