示例#1
0
 /**
  * Responds to requests to POST /lorem
  */
 public function postGenerate(Request $request)
 {
     // Validate the request data
     // num_users - how many users should be created
     // tb_word_count - how many words in password
     $this->validate($request, ['num_users' => 'required|integer|min:1|max:99', 'tb_word_count' => 'integer|min:1|max:9']);
     $num_users = $request->input('num_users');
     $lang = $request->input('lang');
     $address = $request->input('address');
     $profile = $request->input('profile');
     $tb_word_count = $request->input('tb_word_count');
     $cb_number = $request->input('cb_number');
     $cb_symbol = $request->input('cb_symbol');
     $pwd_case = $request->input('pwd_case');
     //call functions here and populate arrays.  Be sure to pass arrays to
     //view below.  On view, can use syntax:  echo implode('<p>', $x_array);
     $a = new \App\PwdGenerator($tb_word_count, $pwd_case, $cb_number, $cb_symbol);
     $pwd_array = [];
     for ($i = 0; $i < $num_users; $i++) {
         $pwd_array[$i] = $a->PrintPwd();
     }
     return view('random.generate')->with('num_users', $num_users)->with('lang', $lang)->with('address', $address)->with('profile', $profile)->with('tb_word_count', $tb_word_count)->with('cb_number', $cb_number)->with('cb_symbol', $cb_symbol)->with('pwd_case', $pwd_case)->with($pwd_array);
 }