1. Go to this page and download the library: Download webman-tech/laravel-console 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/ */
namespace app\command;
use Illuminate\Console\Command;
class SendEmails extends Command
{
protected $signature = 'mail:send {userId}';
protected $description = 'Send a marketing email to a user';
public function handle(Mailer $mailer): void
{
$mailer->send(User::find($this->argument('userId')));
}
}
use \WebmanTech\LaravelConsole\Facades\Artisan;
Artisan::call('mail:send', ['userId' => 1]);
bash
php artisan mail:send 1
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.