21 lines
464 B
PHP
21 lines
464 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\Traits;
|
||
|
|
||
|
use App\Mail\UserSelfActivated;
|
||
|
use App\User;
|
||
|
use Illuminate\Support\Facades\Mail;
|
||
|
|
||
|
trait ActivatesUsers
|
||
|
{
|
||
|
private function sendUserActivatedEmails(User $createdUser)
|
||
|
{
|
||
|
$adminUsers = User::where('is_admin', true)->get();
|
||
|
|
||
|
/** @var User $adminUser */
|
||
|
foreach ($adminUsers as $adminUser)
|
||
|
{
|
||
|
Mail::to($adminUser)->send(new UserSelfActivated($adminUser, $createdUser));
|
||
|
}
|
||
|
}
|
||
|
}
|