Skip to content

Instantly share code, notes, and snippets.

@Faizanq
Created July 27, 2022 06:20
Show Gist options
  • Save Faizanq/60fd21b3f4c4ee71876fbe2429d5295d to your computer and use it in GitHub Desktop.
Save Faizanq/60fd21b3f4c4ee71876fbe2429d5295d to your computer and use it in GitHub Desktop.
<?php
namespace App\Observers;
use App\Mail\WelcomeNewCustomer;
use App\Models\Customer;
use Illuminate\Support\Facades\Mail;
class CustomerObserver
{
public function created(Customer $model)
{
$email = $model->email;
try
{
Mail::to($to)->send(new WelcomeNewCustomer($model));
}
catch(\Throwable $th)
{
\Log::error('WelcomeNewCustomer Mail sending failed');
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment