Plain form
Plain form is useful when you want quickly to create a form, for which you do not need separate Form class.
It basicallly instantiates Kris\LaravelFormBuilder\Form
class. It’s same as creating regular form, only the
first parameter is skipped.
<?php
$formOptions = [
'url' => route('password.reset'),
'method' => 'POST'
];
$form = \FormBuilder::plain($formOptions)->add('email', 'email', [
'label' => 'Email address'
]);
Or if you use the FormBuilderTrait
in controller:
<?php
use Kris\LaravelFormBuilder\FormBuilderTrait;
class UserController extends Controller {
use FormBuilderTrait;
public function userPage()
{
$form = $this->plain($formOptions)->add('email', 'email', [
'label' => 'Email address'
]);
return view('user', compact('form'));
}
}