2

I need to use

echo HTML::script('js/ckeditor/ckeditor.js');

in my controller and function, but error not found HTML

I am using larvel 5.0. tnx

reza_khalafi
  • 6,230
  • 7
  • 56
  • 82

1 Answers1

3

HTML and FORM are removed from Laravel 5+ to use them you have to include them in composer.json. And add an Alias and Service Provider in config\app.php You can find them here

And as from laravel 5 {{}} is same as {{e('sting')}} //htmlentities To output html you need to use {!! HTML::() !!} without htmlentities

And if you need to use echo Simply wrap it to <?php ?> tags <?php echo HTML::() ?>

And if you use it Controller you need to use like \Html::() or before Controller class add use HTML;

HTML or Html depends on you Alias array in config\app.php

composer.json

"illuminate/html": "^5.0",

Config/app.php Service Provider

'Illuminate\Html\HtmlServiceProvider',

Config/app.php aliases

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

Controller

<?php namespace App\Http\Controllers;
use HTML;
class SomeController extends Controller{
    public function foo(){
        echo HTML::();
    }
}
SergkeiM
  • 3,934
  • 6
  • 36
  • 69