SmsController.php 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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 SmsController 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/sms
  17. */
  18. public function index()
  19. {
  20. return view('admin.config.form.sms', []);
  21. }
  22. /**
  23. * 문자 양식 저장
  24. * @method POST
  25. * @see /admin/config/form/sms
  26. */
  27. public function store(Request $request)
  28. {
  29. $rules = [
  30. 'send_sms_register_form_content' => 'string|nullable',
  31. 'send_sms_changepw_form_content' => 'string|nullable',
  32. 'send_sms_withdraw_form_content' => 'string|nullable',
  33. 'send_sms_auth_form_content' => 'string|nullable',
  34. 'send_sms_find_form_content' => 'string|nullable',
  35. 'send_sms_post_form_content' => 'string|nullable',
  36. 'send_sms_comment_form_content' => 'string|nullable',
  37. 'send_sms_post_blame_form_content' => 'string|nullable',
  38. 'send_sms_comment_blame_form_content' => 'string|nullable',
  39. 'send_sms_post_personal_form_content' => 'string|nullable',
  40. 'send_sms_post_personal_reply_form_content' => 'string|nullable'
  41. ];
  42. $attributes = [
  43. 'send_sms_register_form_content' => '회원가입',
  44. 'send_sms_changepw_form_content' => '비밀번호 변경',
  45. 'send_sms_withdraw_form_content' => '회원탈퇴',
  46. 'send_sms_auth_form_content' => '이메일 인증',
  47. 'send_sms_find_form_content' => '회원정보 찾기',
  48. 'send_sms_post_form_content' => '게시글 작성',
  49. 'send_sms_comment_form_content' => '댓글 작성',
  50. 'send_sms_post_blame_form_content' => '게시글 신고',
  51. 'send_sms_comment_blame_form_content' => '댓글 신고',
  52. 'send_sms_post_personal_form_content' => '1:1 문의 접수 - 게시글',
  53. 'send_sms_post_personal_reply_form_content' => '1:1 문의 답변 - 댓글'
  54. ];
  55. $posts = $this->validate($request, $rules, [], $attributes);
  56. $this->configModel->save($posts, $attributes);
  57. $message = '문자 양식 정보가 저장되었습니다.';
  58. return redirect()->route('admin.config.form.sms.index')->with('message', $message);
  59. }
  60. }