Laravel 5 validation in model
<p>I have model like this</p>

<pre><code>class test extends Model
{

public   $rules = [
    'title' =&gt; 'required',
    'name' =&gt; 'required',
];
protected $fillable = ['title','name'];
}
</code></pre>

<p>And controller like this</p>

<pre><code>public function store(Request $request)
{
    $test=new test; /// create model object
        $validator = Validator::make($request-&gt;all(), [
             $test-&gt;rules
        ]);
        if ($validator-&gt;fails()) {
            return view('test')-&gt;withErrors($validator)
        }
        test::create($request-&gt;all());
 }
</code></pre>

<p>Validation show error like this</p>

<blockquote>
  <p>The 0 field is required.</p>
</blockquote>

<p>I want show this</p>

<blockquote>
  <p>The name field is required.<br>
  The title field is required.</p>
</blockquote>