Note that there are some explanatory texts on larger screens.

plurals
  1. POLaravel validation not showing errors
    primarykey
    data
    text
    <p>This is probably a simple fix... but I can't get validation to work.</p> <p>I've simplified my test back to this...</p> <pre><code> $input = array( 'name' =&gt; '' ); $rules = array( 'name' =&gt; 'required|min:3|max:50|alpha' ); $v = Validator::make($input, $rules); </code></pre> <p>And even though 'name' is required and has all the other rules the validator doesn't contain any errors.</p> <pre><code>dd($v-&gt;errors); // returns NULL </code></pre> <p>However</p> <pre><code>dd($v-&gt;fails()); // returns bool(true) </code></pre> <p>Why are there no error messages? When I dump the whole $v object there are no messages to be seen anywhere. Very confused... help appreciated. Thanks.</p> <p>---- edit</p> <p>I've simplified this even further. I've put this directly in a view to test...</p> <pre><code>&lt;?php $input = array( 'name' =&gt; '' ); $rules = array( 'name' =&gt; 'required' ); $v = Validator::make($input, $rules); dd($v); ?&gt; </code></pre> <p>I still get exactly the same problem?</p> <p>Here is the $v object</p> <pre><code>object(Laravel\Validator)#32 (9) { ["attributes"]=&gt; array(1) { ["name"]=&gt; string(0) "" } ["errors"]=&gt; NULL ["rules":protected]=&gt; array(1) { ["name"]=&gt; array(1) { [0]=&gt; string(8) "required" } } ["messages":protected]=&gt; array(0) { } ["db":protected]=&gt; NULL ["bundle":protected]=&gt; string(11) "application" ["language":protected]=&gt; NULL ["size_rules":protected]=&gt; array(4) { [0]=&gt; string(4) "size" [1]=&gt; string(7) "between" [2]=&gt; string(3) "min" [3]=&gt; string(3) "max" } ["numeric_rules":protected]=&gt; array(2) { [0]=&gt; string(7) "numeric" [1]=&gt; string(7) "integer" } } </code></pre> <p>Is something in my installation/setup broken?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload