PHP code example of schantldev / statamic-formattach

1. Go to this page and download the library: Download schantldev/statamic-formattach 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/ */

    

schantldev / statamic-formattach example snippets


/*
|--------------------------------------------------------------------------
| Send Email Job
|--------------------------------------------------------------------------
|
| The class name of the job that will be used to send an email.
|
*/

'send_email_job' => \SchantlDev\Statamic\FormAttach\Forms\SendEmailWithAttachments::class,

'forms' => [
    'form_handle' => [
        // \SchantlDev\Statamic\FormAttach\Attachments\AttachPdf::class,
    ],
],

use Illuminate\Mail\Mailables\Attachment;

abstract class FormAttachment {
    ...
    public function check(): bool;
    abstract public function attachment(): ?Attachment;
}

namespace App\FormAttachments;

use SchantlDev\Statamic\FormAttach\Attachments\AttachPdf;

class PdfAttachment extends AttachPdf
{
    public function check(): bool
    {
        return $this->submissionHelper->config['html'] == 'email/form_owner';
    }
}
bash
php artisan vendor:publish --tag=statamic-formattach-config
bash
php artisan vendor:publish --tag=statamic-formattach-views