HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/Neopoints/momsecurity.be/app/Komma/Auth/AuthMailService.php
<?php


namespace App\Komma\Auth;


use App\Komma\Shop\Orders\Kms\OrderMailService;
use App\Komma\Users\Models\Role;
use App\Komma\Users\Models\User;
use App\Notifications\CustomerRegistered;
use App\Notifications\CustomerRegisteredSetPassword;

/**
 * Class AuthMailService
 *
 * A service responsible for sending mails about authorisation and authentication.
 *
 * @see OrderMailService
 * @package App\Komma\Auth
 */
class AuthMailService implements AuthMailServiceInterface
{
    /**
     * Notify admins that a new user has been created
     *
     * @param $customer
     * @return null
     */
    public function notifyAdminsForNewCustomer(User $customer)
    {
        User::where('role_id', '=', Role::Admin)->get()->each(function(User $admin) use ($customer) {
            $admin->notify(new CustomerRegistered($customer));
            \Log::debug('Notified admin with id: '.$admin->id.' that user with id '.$customer->id.' registered');
        });
        return null;
    }

    /**
     * Notify user that he needs to set a password to login
     *
     * @param User $newUser
     * @return null
     */
    public function notifyUserToSetPassword(User $newUser)
    {
        $token = \Password::getRepository()->create($newUser);
        $newUser->notify(new CustomerRegisteredSetPassword($newUser, $token));
        return null;
    }
}