EmailController.php 4.5 KB

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