use \Form\Macro as Form; $form = Form::create('contact'); $form->text('name', 'Your Name')->required(); $form->email('email', 'Your Email')->required(); $form->textarea('message', 'Message')->required(); $form->submit('Send');
use \Form\Macro as Form; $form = Form::create('registration'); $form->text('name', 'Your Name')->required(); $form->email('email', 'Your Email')->required(); $form->password('password', 'Password')->required(); $form->password('password_confirmation', 'Confirm Password')->required(); $form->submit('Register');This example code will generate a registration form with four fields (name, email, password, and confirm password) and a submit button. The required() method will ensure that each field is filled in before the form can be submitted. Package library: The PHP Form macro is a part of the Laravel Collective package, which provides a suite of useful utilities for Laravel applications.