PHP code example of copain / laravel-mail-dashboard

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

    

copain / laravel-mail-dashboard example snippets


return [
    // When disabled, outgoing emails are not captured and every
    // dashboard route returns a 404.
    'enabled' => env('MAIL_DASHBOARD_ENABLED', env('APP_ENV', 'production') === 'local'),

    // The URI path where the dashboard is served.
    'path' => env('MAIL_DASHBOARD_PATH', 'mail-dashboard'),

    // Middleware applied to every dashboard route.
    'middleware' => ['web'],

    // Where captured emails are stored (one JSON file each).
    'storage' => [
        'disk' => env('MAIL_DASHBOARD_DISK'),
        'path' => env('MAIL_DASHBOARD_STORAGE_PATH', 'mail-dashboard'),
    ],
];

use Illuminate\Support\Facades\Gate;

Gate::define('viewMailDashboard', function (?User $user) {
    return in_array($user?->email, [
        '[email protected]',
    ]);
});
bash
php artisan vendor:publish --tag="laravel-mail-dashboard-config"