Created
July 27, 2022 06:20
-
-
Save Faizanq/60fd21b3f4c4ee71876fbe2429d5295d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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