Пример #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!');
 }
 /**
  *
  * Delete Users
  * @param lists $ids Users Ids
  * @return Json Response
  */
 private function deleteUsers($ids)
 {
     if (!is_null($ids)) {
         foreach ($ids as &$value) {
             $user = user::find($value);
             if ($user->level < 10 && $user->verified == 0) {
                 $deletedUser = new deletedUser();
                 $deletedUser->name = $user->name;
                 $deletedUser->email = $user->email;
                 $deletedUser->save();
                 //Mail::send('mailtemplate/accountDelete', ['name'=> $user->name], function ($m) use ($user) {
                 //	$m->from('*****@*****.**', 'Native Physician');
                 //	$m->to($user->email, $user->name)->subject('Account Deleted');
                 //});
                 $user->delete();
             }
         }
     } else {
         return response()->json(['message' => 'hacker', 'code' => 'error']);
     }
     return response()->json(['code' => 'success', 'task' => 'DeleteUsers']);
 }