PHP code example of spatie / laravel-mailable-test
1. Go to this page and download the library: Download spatie/laravel-mailable-test 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/ */
spatie / laravel-mailable-test example snippets
return [
/*
* This class will be used to generate argument values for the constructor
* of a mailable. This can be any class as long as it
* extends \Spatie\MailableTest\ArgumentValueProvider::class
*/
'argument_value_provider_class' => \Spatie\MailableTest\FakerArgumentValueProvider::class,
/*
* Base namespace Mailable classes
*/
'base_namespace' => 'App\Mail',
];
public function __construct(string $title, Order $order)
{
...
}
namespace App;
use Spatie\MailableTest\FakerArgumentValueProvider;
class MyCustomArgumentValueProvider extends FakerArgumentValueProvider
{
protected function getModelInstance(string $mailableClass, string $argumentName, Model $model, $id): Model
{
return factory(get_class($model));
}
}