欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

Class 'Form' not found clas Form not found

我已经向composer.json添加了“illuminate / html”:“5. *”并运行“composer update”。

  - Installing illuminate/html (v5.0.0)
    Loading from cache

我在网站的根目录下运行了这个命令。我在/root/.composer ..和项目的根目录中修改了composer.json文件,也没有改变。

This downloaded the class and it seemed to install. I have added the following to config/app.php

    'Illuminate\Html\HtmlServiceProvider', 

    'Form'      => 'Illuminate\Html\FormFacade',
    'Html'      => 'Illuminate\Html\HtmlFacade',

I think i have an idea what is wrong, but i dont know how to fix it. My install is in '/var/www/website'. I have checked the file path and the Html folder does not exist.

"/var/www/website/vendor/laravel/framework/src/Illuminate/Html"

i was able to find the class files but in a different directory.

"/var/www/website/vendor/illuminate/html"

I manually copied the files over to the main laravel illuminate/html folder, but this hasn't worked either.

shareimprove this question
 

This may not be the answer you're looking for, but I'd recommend using the now community maintained repository Laravel Collective Forms & HTML as the main repositories have been deprecated.

shareimprove this answer
 
   
Any idea why this was removed in v5? – musicliftsme May 24 '15 at 6:46
3 
seems they want to make it more lightweight and let people add things only when they need them. – Dan Hastings May 25 '15 at 7:18
   
Have they noticed it in the upgrade guide or somewhere else ? did not see it. – KeizerBridge Jun 9 '15 at 17:04
   
Thanks didn't know this new to laravel and its still in the main docs so I had no idea this wasn't in v5. – SamJan 13 '16 at 9:43

Form isn't included in laravel 5.0 as it was on 4.0, steps to include it:

Begin by installing this package through Composer. Edit your project's composer.json file to require laravelcollective/html

"require": {
    "laravelcollective/html": "~5.0"
}

Next, update composer from the Terminal:

composer update

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

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

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

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

At this point, Form should be working

SRC:

https://laravelcollective.com/docs/5.0/html

shareimprove this answer
 
1 
Yes, this is the solution. – zygimantus Oct 13 '16 at 17:44
1 
SRC链接已更新。laravelcollective.com/docs/5.3/html 从5.0到5.3,他们更改了提供程序和别名部分。Collective \ Html \ HtmlServiceProvider :: class,对于提供者,然后'Form'=> Collective \ Html \ FormFacade :: class,'Html'=> Collective \ Html \ HtmlFacade :: class,用于别名。 -  马蒂 12月24日16时12分25分

您还可以尝试在终端或命令中运行以下命令:
1. composer dump-autocomposer dump-auto -o 
2. php artisan cache:clear 
3。php artisan config:clear

以上为我工作

分享改善这个答案
 

Laravel 5.2有一个更新。请注意,这是与上述不同的格式。

首先通过Composer安装这个包。编辑您的项目的composer.json文件以要求laravelcollective / html。

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

接下来,从终端更新Composer:

作曲家更新接下来,将您的新提供者添加到config / app.php的providers数组中:

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

最后,将两个类别别添加到config / app.php的别名数组中:

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

在进行此更新后,此代码对我的Laravel 5.2的新安装有效:

{!! Form::open(array('url' => 'foo/bar')) !!}
    //
{!! Form::close() !!}

我在这里获得了这些信息:https//laravelcollective.com/docs/5.2/html

分享改善这个答案
 

Form使用form,资本化数量。

分享改善这个答案
 

首先通过Composer安装这个包。从终端运行以下命令:

composer require "laravelcollective/html":"^5.3.0"

接下来,将您的新提供程序添加到config / app.php的providers数组中:

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

最后,将两个类别别添加到config / app.php的别名数组中:

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

SRC:

https://laravelcollective.com/docs/5.3/html

分享改善这个答案
 

在Laravel Version - 4中,HTML&Form已存在,但现在不存在。

为什么

Only reason is they have collected some user requirements and they want it more lightweight and so they removed it as this sense that user can add it manually.

What to do to add HTML & Forms in Laravel 5.2 or 5.3:

For 5.2:

Go to the Laravel Collective site and installation processes have demonstrated their.

Like for 5.2: in command line run the command

composer require "laravelcollective/html":"^5.2.0"

Then, in provider array which is in config/app.php. Add this line at last using a comma(,)

Collective\Html\HtmlServiceProvider::class,

For use HTML and FORM text we need to aliases them in aliases array of config/app.php. Add the two line at the last

'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,

And for 5.3:

Just run the command

composer require "laravelcollective/html":"^5.3.0"

And rest of the procedure is like 5.2

Then you can use Laravel Form and other HTML links in your projects. For this follow this documentation:

5.2 : https://laravelcollective.com/docs/5.2/html

5.3: https://laravelcollective.com/docs/5.3/html

Demo Code : To open a form open and close tag :

{!! Form::open(['url' => 'foo/bar']) !!}

{!! Form::close() !!}

And for creating label and input text with a bootstrap form-control class and other use :

{!! Form::label('title', 'Post Title') !!}
{!! Form::text('title', null, array('class' => 'form-control')) !!}

And for more, use the documentation https://laravelcollective.com/

shareimprove this answer
 
composer require "laravelcollective/html"

just type this command in terminal at project directory and installation is done according laravel version and don't forget to add this lines in app.php under config folder

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

],

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

],

来自 http://stackoverflow.com/questions/28753767/laravel-5-class-form-not-found

普通分类: