示例#1
2
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $tasks = cronResetPassword::all();
     foreach ($tasks as $task) {
         Mail::queue('mailtemplate/passwordreset', ['name' => $task->name, 'pass' => $task->password], function ($m) use($task) {
             $m->from('*****@*****.**', 'Native Physician');
             $m->to($task->email, $task->name)->subject('New Password!');
         });
         $task->delete();
     }
     $deletedUsers = deletedUser::all();
     foreach ($deletedUsers as $deletedUser) {
         Mail::queue('mailtemplate/accountDelete', ['name' => $deletedUser->name], function ($m) use($deletedUser) {
             $m->from('*****@*****.**', 'Native Physician');
             $m->to($deletedUser->email, $deletedUser->name)->subject('Your Account Removed!');
         });
         $deletedUser->delete();
     }
     $disabledUsers = disabledUser::all();
     foreach ($disabledUsers as $disabledUser) {
         Mail::queue('mailtemplate/accountDeactivate', ['name' => $disabledUser->name], function ($m) use($disabledUser) {
             $m->from('*****@*****.**', 'Native Physician');
             $m->to($disabledUser->email, $disabledUser->name)->subject('Your Account Disabled!');
         });
         $disabledUser->delete();
     }
     $this->info('Password reset emails were sent successfully!');
 }