Class form or html not found in Laravel 5

Class form or html not found in Laravel 5

Class form or html not found in Laravel 5 :-

Recently i am working with new laravel 5 and found there is more changes or you can say it’s whole rebuild new version. also if you are working with form or html classes you will get Class form or html not found in Laravel 5.

Why error Class Form or HTML not found in Laravel 5 ?

Because of default in Laravel 5 Html and Form are not embedded anymore. Now form builder is a separate package. you need to Pull in “illuminate/html” to get it back.

For this i am sharing below steps how we can pull it back or how we can resolve error Class Form or HTML not found in Laravel 5.

1.Open your “root/composer.json” and add below line in “require” section :

"illuminate/html": "5.*"

Example:- so now your file code of require section looks like:-

"require": {
    "illuminate/html": "5.*",
    "laravel/framework": "5.0.*"
  },

2.Now you need to run “composer update” coomand. for this pick up your laravel application directory path in CLI or terminal and run

composer update

Now after successfully install “Illuminate\Html” you need to add this Laravel Framework Service Providers list. for this go to “config/app.php” and add below code to “providers” array to further use:

'Illuminate\Html\HtmlServiceProvider',

Example:- so now your file code of provider array section looks like:-


'providers' => [
   /* more already here */
   'Illuminate\Html\HtmlServiceProvider',

3.Now go to “config/app.php” and below code to “aliases” array:


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

Example:- so now your file code of aliases array section looks like:-


'aliases' => [
   /* more already here */
    'Html' => 'Illuminate\Html\HtmlFacade',
    'Form' => 'Illuminate\Html\FormFacade',
 ],

Now try in your example.blade.php with new syntax {!! $var !!} old style {{$var}} and {{{$var}}} has been deprecated and removed. so use like below example.

Why deprecated ?:- In laravel 4 it included the following two styles: “{{” and “{{{“. The double curly bracket was a raw echo and the triple curly bracket escaped. Currently in laravel 5 both the double and triple curly brackets escape the variable and a new “{!! $var !!}” is for raw.

{!! Form::open() !!}
{!! Form::text('name', @$name) !!}
{!! Form::submit('Send') !!}
{!! Form::close() !!}

Now run your file and you have solved error Class Form or HTML not found in Laravel 5.



from :http://www.tuicool.com/articles/vmEvYrz

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值