Laravel 5.1 - Form: method number does not exist

I just upgraded to Laravel 5.1 and I am creating a simple form with text and number inputs. My problem came up when I need to declare a numeric one of the input fields:

{!! Form::number('otp', null, ['class' => 'form-control', 'placeholder' => 'OTP']) !!}

      

It prints this error: Method number does not exist. Depending on, I don't see the "Html and Forms" section in the docs, they seem to have removed it.

Has anyone had the same problem with Laravel 5.1?

+3


source to share


2 answers


You can use {!! Form::input('number', 'otp', null, ['class' => 'form-control']) !!}

.



+3


source


Some rules seem to have changed in 5.1, so to fix this issue first update composer .json:

"require": {
    "laravelcollective/html": "5.1.*"
}

      

then the app.php file:



'providers' => [
   // ...
   Collective\Html\HtmlServiceProvider::class,
   // ...
],


'aliases' => [
   // ...
     'Form' => Collective\Html\FormFacade::class,
     'Html' => Collective\Html\HtmlFacade::class,
   // ...
],

      

Source: http://laravelcollective.com/docs/5.1/html

+3


source







All Articles