Form Construction

3

After several months without using Laravel, I now return with this version 5. It may sound like bullshit, but I'm having trouble creating a simple form. It seems that the Illumiante / html is not coming by default in the framework, so it is necessary to make some modifications.

I added the following lines to each file:

composer.json

"illuminate/html": "5.0.*@dev"

config / app.php

'Illuminate\View\ViewServiceProvider',
'Illuminate\Html\HtmlServiceProvider',

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

My view

{{ Form::open(array('action' => 'HomeController@gerarPdf'))}}  
    {{ Form::text('name', 'name') }}  
    {{ Form::password('password') }}  
    {{ Form::submit('Send') }}  
{{ Form::close() }}

HomeController

public function gerarPdf() {
    return 'ola mundo';
}

Error Message

OBS

I already gave the composer update and the method has already been created in the controller.

    
asked by anonymous 20.02.2015 / 16:41

2 answers

1

The old Laravel Html project is now maintained by Laravel Collective . I updated some items, starting with composer.json .

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

After running composer update , I updated the config / app.php

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

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

And the syntax has also been modified.

{!! Form::open(array('action' => 'HomeController@gerarPdf')) !!}
    {!! Form::text('username') !!}
{!! Form::close() !!}
    
23.02.2015 / 14:51
0

Remember that illuminate/html still exists as a Laravel component and works perfectly with Laravel 5.

Run insert dependency via composer:

composer require illuminate/html:~5.0

And update config/app.php

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

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

It is worth remembering that these packages have not received updates in the Laravel core, and some functionality may stop working.

    
04.03.2015 / 15:58