PHP code example of kirschbaum-development / nova-mail
1. Go to this page and download the library: Download kirschbaum-development/nova-mail 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/ */
kirschbaum-development / nova-mail example snippets
use KirschbaumDevelopment\NovaMail\Traits\Mailable;
class User extends Model
{
use Mailable;
/**
* Get the name of the email field for the model.
*
* @return string
*/
public function getEmailField(): string
{
return 'email';
}
// ...
}
namespace App\Nova;
use KirschbaumDevelopment\NovaMail\Actions\SendMail;
class User extends Resource
{
// ...
public function actions(Request $request)
{
return [
// ...
new SendMail,
];
}
}
namespace App\Nova;
use Laravel\Nova\Fields\HasMany;
use KirschbaumDevelopment\NovaMail\Nova\NovaSentMail;
class User extends Resource
{
// ...
public function fields(Request $request)
{
return [
// ...
HasMany::make('Sent Mail', 'mails', NovaSentMail::class),
// ...
];
}
}
/*
|--------------------------------------------------------------------------
| Default Resources
|--------------------------------------------------------------------------
|
| This determines which Nova Resources you're using
| You can change it as you wish
|
*/
'default_resources' => [
'nova_mail_event' => App\Nova\YourNovaMailEventResource::class,
'nova_mail_template' => App\Nova\YourNovaMailTemplateResource::class,
'nova_sent_mail' => App\Nova\YourNovaSentMailResource::class,
],
use KirschbaumDevelopment\NovaMail\Nova\NovaSentMail;
class YourNovaSentMailResource extends NovaSentMail
{
public function cards(Request $request)
{
return [
// Your custom code...
];
}
}
bash
php artisan migrate
bash
php artisan vendor:publish
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.