PHP code example of pod-point / laravel-mail-export

1. Go to this page and download the library: Download pod-point/laravel-mail-export 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/ */

    

pod-point / laravel-mail-export example snippets




namespace App\Mail;

use Illuminate\Mail\Mailable;
use PodPoint\MailExport\Concerns\Exportable;
use PodPoint\MailExport\Contracts\ShouldExport;

class OrderShipped extends Mailable implements ShouldExport
{
    use Exportable;

    // ...
}



namespace App\Mail;

use Illuminate\Mail\Mailable;
use PodPoint\MailExport\Concerns\Exportable;
use PodPoint\MailExport\Contracts\ShouldExport;

class OrderShipped extends Mailable implements ShouldExport
{
    use Exportable;

    public $exportDisk = 'some_disk';

    public $exportPath = 'some_path';

    public $exportFilename = 'some_filename';

    // ...
}



namespace App\Mail;

use Illuminate\Mail\Mailable;
use PodPoint\MailExport\Concerns\Exportable;
use PodPoint\MailExport\Contracts\ShouldExport;

class OrderShipped extends Mailable implements ShouldExport
{
    use Exportable;

    // ...

    public function exportDisk(): string
    {
        return 'some_disk';
    }

    public function exportPath(): string
    {
        return 'some_path';
    }

    public function exportFilename(): string
    {
        return 'some_filename';
    }
}

Mail::to($request->user())->send(new OrderShipped($order));



namespace App\Notifications;

use App\Mail\OrderShipped as Mailable;
use Illuminate\Notifications\Notification;

class OrderShipped extends Notification
{
    // ...

    public function toMail($notifiable)
    {
        return (new Mailable($this->order))->to($notifiable->email);
    }
}
bash
php artisan vendor:publish --provider="PodPoint\MailExport\MailExportServiceProvider"