PHP code example of think.studio / laravel-forms-entries

1. Go to this page and download the library: Download think.studio/laravel-forms-entries 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/ */

    

think.studio / laravel-forms-entries example snippets


\FormEntries\Facades\FormEntryManager::routes();

$formEntry = \FormEntries\Forms\UniversalForm::make()
                ->enableStoringData()
                ->enableNotifications()
                ->process($request);

// /app/Http/FormEntries/FormContent/ContactUsFormContent.php
class ContactUsFormContent extends FormContent
{
    protected array $requestKeysToSave = ['email', 'message'];

    public function validateRequest(Request $request): static
    {
        $request->validate([
            'email'   => ['

// /app/Http/FormEntries/Forms/ContactUsForm.php
class ContactUsForm extends Form
{
    protected string $formContentClass = ContactUsFormContent::class;

    public function notify(FormEntry $model): bool
    {
        Notification::route('mail', '[email protected]')
                    ->notify(new ($this->getFormNotificationClass())($model->content));

        return true;
    }
}
bash
php artisan vendor:publish --provider="FormEntries\ServiceProvider" --tag="config"
php artisan vendor:publish --provider="FormEntries\ServiceProvider" --tag="lang"