LoginController.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. namespace App\Http\Controllers\Admin\Config\Register;
  3. use Illuminate\Http\Request;
  4. use App\Http\Controllers\Controller;
  5. use App\Models\Config;
  6. class LoginController extends Controller
  7. {
  8. private Config $configModel;
  9. public function __construct(Config $config)
  10. {
  11. $this->configModel = $config;
  12. }
  13. /**
  14. * 로그인
  15. * @method GET
  16. * @see /admin/config/register/login
  17. */
  18. public function index()
  19. {
  20. return view('admin.config.register.login', []);
  21. }
  22. /**
  23. * 로그인 저장
  24. * @method POST
  25. * @see /admin/config/register/login
  26. */
  27. public function store(Request $request)
  28. {
  29. $rules = [
  30. 'change_password_day' => 'required|numeric|min:0|max:365',
  31. 'max_login_try_count' => 'required|numeric|min:0',
  32. 'max_login_try_limit_second' => 'required|numeric|min:0|max:86400',
  33. 'url_after_login' => 'string|nullable',
  34. 'url_after_logout' => 'string|nullable'
  35. ];
  36. $attributes = [
  37. 'change_password_day' => '비밀번호 갱신주기',
  38. 'max_login_try_count' => '로그인 시도 제한 횟수',
  39. 'max_login_try_limit_second' => '로그인 시도 제한시간',
  40. 'url_after_login' => '로그인 후 이동할 주소',
  41. 'url_after_logout' => '로그아웃 후 이동할 주소'
  42. ];
  43. $posts = $this->validate($request, $rules, [], $attributes);
  44. $this->configModel->save($posts, $attributes);
  45. $message = '정보 수정시 정보가 저장되었습니다.';
  46. return redirect()->route('admin.config.register.login.index')->with('message', $message);
  47. }
  48. }