27 lines
596 B
PHP
27 lines
596 B
PHP
<?php
|
|
|
|
namespace App\Observers;
|
|
|
|
use App\Models\User;
|
|
use App\Models\ContactUs;
|
|
use App\Notifications\UserAdmin;
|
|
|
|
class ContactUsObserver
|
|
{
|
|
/**
|
|
* Handle the ContactUs "created" event.
|
|
*
|
|
* @param \App\Models\ContactUs $contactUs
|
|
* @return void
|
|
*/
|
|
public function created(ContactUs $contactUs)
|
|
{
|
|
$notify['message'] = "$contactUs->name Has Submitted a Contact Us form!";
|
|
$type = "Contact Us";
|
|
$users = User::admins()->get();
|
|
foreach ($users as $data) {
|
|
$data->notify(new UserAdmin($notify,$type));
|
|
}
|
|
}
|
|
}
|