HansSchouten / Laravel-Pagebuilder

A drag and drop pagebuilder to manage pages in any Laravel project
https://www.phpagebuilder.com
MIT License
800 stars 184 forks source link

Form handling methods #84

Closed dumithsalinda closed 3 years ago

dumithsalinda commented 3 years ago

Hi, Is there a way to handle the form submission features within the block it self. Send a mail or the add to database etc.

Thank you

HansSchouten commented 3 years ago

Hi, yes that is possible by creating a controller file for the block. Like in this example by creating the file themes\your-theme\blocks\example-block\controller.php:

<?php

namespace Themes\YourTheme\Blocks\ExampleBlock;

use PHPageBuilder\Modules\GrapesJS\Block\BaseController;

class Controller extends BaseController
{
    /**
     * Handle the current request.
     */
    public function handleRequest()
    {
        // handle form submit
    }
}