php - How to validate an Input Array field in Laravel 5.1? -


how can write rule input field below:

{!! form::number("amount[]",null,['min' => 0, 'class' => 'form-control col-xs-2 ']) !!} 

i tried following gave error: htmlentities() expects parameter 1 string, array given

        $rules = array(             'amount[]' => 'required'         );         $this->validate($request, $rules); 

update:

i tried suggested user, it's not redirecting on page again. below controller method:

public function postestimate(request $request) {         $rules = array(             'amount' => 'required|array'         );          $this->validate($request, $rules);     } 

i guess got issues explained meant -

$rules = []; $count_amounts = count($request->input('amount')); foreach (range(0, $count_amounts) $number) {     $rules['amount.' . $number] = 'required|integer|min:0'; } 

this should check each amount input have integer , bigger 0 (like defined in html validation)


Comments

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -