public function sendPasswordResetEmail() { $token = md5(Carbon::now() . env('APP_KEY')); $reset = new PasswordReset(); $reset->user_id = $this->id; $reset->token = $token; $reset->save(); $n = new Notifier($this); $n->sendEmail("BoilerMake Password Reset!", 'password-reset', ['token_url' => getenv('FRONTEND_ADDRESS') . "/pwr?tok=" . $token]); }
public function sendGroupMessage(Request $request) { switch ($request->group) { case "all": $roles = ['exec', 'hacker', 'sponsor']; break; case "hackers": $roles = ['exec', 'hacker']; break; case "sponsors": $roles = ['exec', 'sponsor']; break; case "exec": $roles = ['exec']; break; } $users = User::whereHas('roles', function ($q) use($roles) { $q->whereIn('name', $roles); })->get(); foreach ($users as $u) { $n = new Notifier($u); $n->sendSMS($request->message, 'group-message'); } $log = new GroupMessage(); $log->group = $request->group; $log->message = $request->message; $log->num_recipients = $users->count(); $log->save(); return ['status' => 'ok', 'message' => 'message sent to' . $users->count() . 'users']; }