1. Go to this page and download the library: Download netcore/module-form library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
netcore / module-form example snippets
app('forms')->replace('[form=(ID/Key)]');
// or you can use helper method
form()->render('ID/Key');
If you want to render form with different template,
you can create new file in /views/templates/forms (path can be changed in configuration),
for example - contact-us.blade.php, where "contact-us" can be form key or the template name set when creating/editing form
// For example, if you want to send email to Administrator and/or User, who submitted the "Contact Us" form
use Modules\Form\Repositories\FormsRepository;
use Nwidart\Modules\Facades\Module;
$module = Module::find('form');
if ($module AND $module->enabled()) {
FormsRepository::addNewEvent('contact-us', function ($data) {
Mail::to('[email protected]')->queue(new NotifyAboutContactMessage($data));
});
}
// $data variable is array, which consists of submitted data, for example
$data = [
'name' => 'John',
'email' => '[email protected]',
'message' => 'Lorem ipsum.'
];
php artisan module:publish Form
php artisan module:publish-config Form
php artisan module:publish-migration Form
php artisan migrate
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.