EmailController.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. namespace App\Http\Controllers\Admin\User\Dormant\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/user/dormant/form/email
  17. */
  18. public function index()
  19. {
  20. return view('admin.user.dormant.form.email', []);
  21. }
  22. /**
  23. * 휴면 계정 관리(이메일) - 알림 발송 양식 저장
  24. * @method POST
  25. * @see /admin/user/dormant/form/email
  26. */
  27. public function store(Request $request)
  28. {
  29. $rules = [
  30. 'send_email_dormant_form_title' => 'string|nullable',
  31. 'send_email_dormant_form_content' => 'string|nullable',
  32. 'send_email_dormancy_form_title' => 'string|nullable',
  33. 'send_email_dormancy_form_content' => 'string|nullable',
  34. 'send_email_recover_form_title' => 'string|nullable',
  35. 'send_email_recover_form_content' => 'string|nullable'
  36. ];
  37. $attributes = [
  38. 'send_email_dormant_form_title' => '휴면 예정 - 제목',
  39. 'send_email_dormant_form_content' => '휴면 예정 - 내용',
  40. 'send_email_dormancy_form_title' => '휴면 전환 - 제목',
  41. 'send_email_dormancy_form_content' => '휴면 전환 - 내용',
  42. 'send_email_recover_form_title' => '휴면 해제 - 제목',
  43. 'send_email_recover_form_content' => '휴면 해제 - 내용'
  44. ];
  45. $posts = $this->validate($request, $rules, [], $attributes);
  46. $this->configModel->save($posts, $attributes);
  47. $message = '이메일 양식 정보가 저장되었습니다.';
  48. return redirect()->route('admin.user.dormant.form.email.index')->with('message', $message);
  49. }
  50. }