Support the ongoing development of Laravel.io →
Input Forms Validation

I'm using the Laracasts\Validation\FormValidator package

how would I setup validation rules for each unique stock field?

<?php namespace Acme\Forms;

use Laracasts\Validation\FormValidator;

class SubmittradeForm extends FormValidator {

protected $rules = [
	'stock_id'    => 'required',//is unique for each stock
	
];

}

   @foreach($stocks as $stock)

<div class="pull-right hidden-sm text-right m-t" style="padding-top:10px;">
	  
		    <div class="">
		        
		        <label class="btn btn-success" ng-model="radioModel"  btn-radio="'true'">UP</label>
		        <input type="hidden" name="{{$stock->id}}" id="{{$stock->id}}" value="@{{radioModel || 'null'}}">
		    </div>
		    <div class="" style="padding-top:5px;">
		        <label class="btn btn-danger" ng-model="radioModel" btn-radio="'false'" uncheckable>DOWN</label>
		   
		    </div>
		     {{ errors_for('$stock->id', $errors) }}
	 </div>
@endforeach
Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

dflow dflow Joined 16 Sep 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.