BasicController.php 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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 BasicController 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/basic
  17. */
  18. public function index()
  19. {
  20. return view('admin.config.register.basic', []);
  21. }
  22. /**
  23. * 기본 저장
  24. * @method POST
  25. * @see /admin/config/register/basic
  26. */
  27. public function store(Request $request)
  28. {
  29. $rules = [
  30. 'use_register_block' => 'numeric|nullable',
  31. 'use_register_email_auth' => 'numeric|nullable',
  32. 'password_min_length' => 'numeric|nullable',
  33. 'password_uppercase_length' => 'numeric|nullable',
  34. 'password_numbers_length' => 'numeric|nullable',
  35. 'password_specialchars_length' => 'numeric|nullable',
  36. 'use_user_thumb' => 'numeric|nullable',
  37. 'user_thumb_width' => 'numeric|nullable',
  38. 'user_thumb_height' => 'numeric|nullable',
  39. 'use_user_icon' => 'numeric|nullable',
  40. 'user_icon_width' => 'numeric|nullable',
  41. 'user_icon_height' => 'numeric|nullable',
  42. 'denied_nickname_list' => 'string|nullable',
  43. 'denied_userid_list' => 'string|nullable',
  44. 'denied_email_list' => 'string|nullable',
  45. 'user_register_policy1' => 'string|nullable',
  46. 'user_register_policy2' => 'string|nullable'
  47. ];
  48. $attributes = [
  49. 'use_register_block' => '회원가입 차단',
  50. 'use_register_email_auth' => '회원가입시 메일 인증 사용',
  51. 'password_min_length' => '비밀번호 보안수준 - 비밀번호 최소',
  52. 'password_uppercase_length' => '비밀번호 보안수준 - 대문자',
  53. 'password_numbers_length' => '비밀번호 보안수준 - 숫자',
  54. 'password_specialchars_length' => '비밀번호 보안수준 - 특수문자',
  55. 'use_user_thumb' => '회원 프로필 사진',
  56. 'user_thumb_width' => '회원 프로필 - 가로 길이',
  57. 'user_thumb_height' => '회원 프로필 - 세로 길이',
  58. 'use_user_icon' => '회원 아이콘',
  59. 'user_icon_width' => '회원 아이콘 - 가로 길이',
  60. 'user_icon_height' => '회원 아이콘 - 세로 길이',
  61. 'denied_nickname_list' => '금지 이름',
  62. 'denied_userid_list' => '금지 ID',
  63. 'denied_email_list' => '금지 E-mail',
  64. 'user_register_policy1' => '회원가입약관',
  65. 'user_register_policy2' => '개인정보취급방침'
  66. ];
  67. $posts = $this->validate($request, $rules, [], $attributes);
  68. $posts['use_register_block'] ??= '0';
  69. $posts['use_register_email_auth'] ??= '0';
  70. $posts['use_user_thumb'] ??= '0';
  71. $posts['use_user_icon'] ??= '0';
  72. $this->configModel->save($posts, $attributes);
  73. $message = '기본 정보가 저장되었습니다.';
  74. return redirect()->route('admin.config.register.basic.index')->with('message', $message);
  75. }
  76. }