laravel 5.4 中的文本区域
Textarea in laravel 5.4
我必须在文本区域 UI (blade.php) 中打印 API 的响应 laravel 5.4。
尝试过:
{{ Form::textarea('response', '3 < 4') }}
但它给出了以下错误:
(1/1) FatalErrorException
Class 'Form' not found
我该怎么做才能做到这一点。简而言之,我想要一个像在 restclient 中一样的响应文本区域。
谢谢!
表单 class 不是 Laravel 5 默认安装的一部分。
安装请参考这里:https://laravelcollective.com/docs/master/html
您需要安装Laravel FormCollective
。
运行 来自终端的以下命令:composer require "laravelcollective/html":"^5.2.0"
接下来,将您的新提供商添加到 config/app.php
的提供商数组中:
'providers' => [
// ...
Collective\Html\HtmlServiceProvider::class,
// ...
],
最后,在config/app.php
的别名数组中添加两个class别名:
'aliases' => [
// ...
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
// ...
],
然后,您可以在 blade 文件中使用 {{ Form::textarea('response', '3 < 4') }}
!
希望你明白!
我必须在文本区域 UI (blade.php) 中打印 API 的响应 laravel 5.4。
尝试过:
{{ Form::textarea('response', '3 < 4') }}
但它给出了以下错误:
(1/1) FatalErrorException
Class 'Form' not found
我该怎么做才能做到这一点。简而言之,我想要一个像在 restclient 中一样的响应文本区域。
谢谢!
表单 class 不是 Laravel 5 默认安装的一部分。 安装请参考这里:https://laravelcollective.com/docs/master/html
您需要安装Laravel FormCollective
。
运行 来自终端的以下命令:composer require "laravelcollective/html":"^5.2.0"
接下来,将您的新提供商添加到 config/app.php
的提供商数组中:
'providers' => [
// ...
Collective\Html\HtmlServiceProvider::class,
// ...
],
最后,在config/app.php
的别名数组中添加两个class别名:
'aliases' => [
// ...
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
// ...
],
然后,您可以在 blade 文件中使用 {{ Form::textarea('response', '3 < 4') }}
!
希望你明白!