Shraddha Banerjee
Shraddha Banerjee

Reputation: 197

Textarea in laravel 5.4

I have to print the reponse of API in textarea UI (blade.php) in laravel 5.4.

Tried doing:

{{ Form::textarea('response', '3 < 4') }}

But it gives the following error:

 (1/1) FatalErrorException

Class 'Form' not found

What can I do to achieve this. In short I want an response textarea like it is in restclient.

Thanks !

Upvotes: 1

Views: 613

Answers (2)

Hiren Gohel
Hiren Gohel

Reputation: 5042

You need to install Laravel FormCollective.

Run the following command from the Terminal: composer require "laravelcollective/html":"^5.2.0"

Next, add your new provider to the providers array of config/app.php:

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

Finally, add two class aliases to the aliases array of config/app.php:

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

Then, you can use {{ Form::textarea('response', '3 < 4') }} in your blade file!

Hope you understand!

Upvotes: 3

ajthinking
ajthinking

Reputation: 4558

The Form class is not a part of the default install of Laravel 5. Please refer to installation here: https://laravelcollective.com/docs/master/html

Upvotes: 1

Related Questions