EmailController.php 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <?php
  2. namespace App\Http\Controllers\Admin\Config\Form;
  3. use Illuminate\Http\Request;
  4. use App\Http\Controllers\Controller;
  5. use App\Models\Config;
  6. class EmailController 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/form/email
  17. */
  18. public function index()
  19. {
  20. return view('admin.config.form.email', [
  21. 'config' => $this->configModel
  22. ]);
  23. }
  24. /**
  25. * 이메일 양식 저장
  26. * @method POST
  27. * @see /admin/config/form/email
  28. */
  29. public function store(Request $request)
  30. {
  31. $rules = [
  32. 'send_email_register_form_title' => 'string|nullable',
  33. 'send_email_register_form_content' => 'string|nullable',
  34. 'send_email_changepw_form_title' => 'string|nullable',
  35. 'send_email_changepw_form_content' => 'string|nullable',
  36. 'send_email_withdraw_form_title' => 'string|nullable',
  37. 'send_email_withdraw_form_content' => 'string|nullable',
  38. /*
  39. 'send_email_auth_form_title' => 'string|nullable',
  40. 'send_email_auth_form_content' => 'string|nullable',
  41. 'send_email_verify_code_form_title' => 'string|nullable',
  42. 'send_email_verify_code_form_content' => 'string|nullable',
  43. */
  44. 'send_email_find_form_title' => 'string|nullable',
  45. 'send_email_find_form_content' => 'string|nullable',
  46. 'send_email_post_form_title' => 'string|nullable',
  47. 'send_email_post_form_content' => 'string|nullable',
  48. 'send_email_comment_form_title' => 'string|nullable',
  49. 'send_email_comment_form_content' => 'string|nullable',
  50. 'send_email_post_blame_form_title' => 'string|nullable',
  51. 'send_email_post_blame_form_content' => 'string|nullable',
  52. 'send_email_comment_blame_form_title' => 'string|nullable',
  53. 'send_email_comment_blame_form_content' => 'string|nullable',
  54. 'send_email_post_personal_form_title' => 'string|nullable',
  55. 'send_email_post_personal_form_content' => 'string|nullable',
  56. 'send_email_post_personal_reply_form_title' => 'string|nullable',
  57. 'send_email_post_personal_reply_form_content' => 'string|nullable'
  58. ];
  59. $attributes = [
  60. 'send_email_register_form_title' => '회원가입 - 제목',
  61. 'send_email_register_form_content' => '회원가입 - 내용',
  62. 'send_email_changepw_form_title' => '비밀번호 변경 - 제목',
  63. 'send_email_changepw_form_content' => '비밀번호 변경 - 내용',
  64. 'send_email_withdraw_form_title' => '회원탈퇴 - 제목',
  65. 'send_email_withdraw_form_content' => '회원탈퇴 - 내용',
  66. /*
  67. 'send_email_auth_form_title' => '이메일 인증',
  68. 'send_email_auth_form_content' => '이메일 인증',
  69. 'send_email_verify_code_form_title' => '인증번호 - 제목',
  70. 'send_email_verify_code_form_content' => '인증번호 - 내용',
  71. */
  72. 'send_email_find_form_title' => '회원정보 찾기 - 제목',
  73. 'send_email_find_form_content' => '회원정보 찾기 - 내용',
  74. 'send_email_post_form_title' => '게시글 작성 - 제목',
  75. 'send_email_post_form_content' => '게시글 작성 - 내용',
  76. 'send_email_comment_form_title' => '댓글 작성 - 제목',
  77. 'send_email_comment_form_content' => '댓글 작성 - 내용',
  78. 'send_email_post_blame_form_title' => '게시글 신고 - 제목',
  79. 'send_email_post_blame_form_content' => '게시글 신고 - 내용',
  80. 'send_email_comment_blame_form_title' => '댓글 신고 - 제목',
  81. 'send_email_comment_blame_form_content' => '댓글 신고 - 내용',
  82. 'send_email_post_personal_form_title' => '1:1 문의 접수 - 제목',
  83. 'send_email_post_personal_form_content' => '1:1 문의 접수 - 내용',
  84. 'send_email_post_personal_reply_form_title' => '1:1 문의 답변 - 제목',
  85. 'send_email_post_personal_reply_form_content' => '1:1 문의 답변 - 내용'
  86. ];
  87. $posts = $this->validate($request, $rules, [], $attributes);
  88. $this->configModel->save($posts, $attributes);
  89. $message = '이메일 양식 정보가 저장되었습니다.';
  90. return redirect()->route('admin.config.form.email.index')->with('message', $message);
  91. }
  92. /**
  93. * 이메일 레이아웃 보기
  94. * @method GET
  95. * @see /admin/config/form/email/layout
  96. */
  97. public function layout()
  98. {
  99. return view('component.email');
  100. }
  101. }