SmsController.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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 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/user/dormant/form/sms
  17. */
  18. public function index()
  19. {
  20. return view('admin.user.dormant.form.sms', []);
  21. }
  22. /**
  23. * 휴면 계정 관리(문자) - 알림 발송 양식 저장
  24. * @method POST
  25. * @see /admin/user/dormant/form/sms
  26. */
  27. public function store(Request $request)
  28. {
  29. $rules = [
  30. 'send_sms_dormant_form_content' => 'string|nullable',
  31. 'send_sms_dormancy_form_content' => 'string|nullable',
  32. 'send_sms_recover_form_content' => 'string|nullable'
  33. ];
  34. $attributes = [
  35. 'send_sms_dormant_form_content' => '휴면 예정',
  36. 'send_sms_dormancy_form_content' => '휴면 전환',
  37. 'send_sms_recover_form_content' => '휴면 해제'
  38. ];
  39. $posts = $this->validate($request, $rules, [], $attributes);
  40. $this->configModel->save($posts, $attributes);
  41. $message = '문자 양식 정보가 저장되었습니다.';
  42. return redirect()->route('admin.user.dormant.form.sms.index')->with('message', $message);
  43. }
  44. }