NoteController.php 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. namespace App\Http\Controllers\Admin\Config\Setting;
  3. use Illuminate\Http\Request;
  4. use App\Http\Controllers\Controller;
  5. use App\Models\Config;
  6. class NoteController 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/setting/note
  17. */
  18. public function index()
  19. {
  20. return view('admin.config.setting.note', []);
  21. }
  22. /**
  23. * 쪽지 저장
  24. * @method POST
  25. * @see /admin/config/setting/note
  26. */
  27. public function store(Request $request)
  28. {
  29. $rules = [
  30. 'use_note' => 'numeric|nullable',
  31. 'note_list_page' => 'numeric|nullable',
  32. 'note_mobile_list_page' => 'numeric|nullable',
  33. 'use_note_mobile_dhtml' => 'numeric|nullable',
  34. 'point_note' => 'numeric|nullable',
  35. 'use_note_file' => 'numeric|nullable',
  36. 'note_save_limit_day' => 'numeric|nullable',
  37. 'note_store_save_limit_day' => 'numeric|nullable',
  38. 'note_save_limit' => 'numeric|nullable',
  39. 'note_once_send_limit' => 'string|nullable',
  40. 'note_today_send_limit' => 'numeric|nullable',
  41. 'note_content_limit' => 'numeric|nullable'
  42. ];
  43. $attributes = [
  44. 'use_note' => '쪽지 기능',
  45. 'note_list_page' => '한페이지 쪽지수 - PC',
  46. 'note_mobile_list_page' => '한페이지 쪽지수 - 모바일',
  47. 'use_note_mobile_dhtml' => '쪽지 DHTML 기능',
  48. 'point_note' => '쪽지 발송시 차감포인트',
  49. 'point_note_file' => '파일 첨부시 차감포인트',
  50. 'use_note_file' => '쪽지 첨부파일 기능',
  51. 'note_save_limit_day' => '기본 보관일',
  52. 'note_store_save_limit_day' => '보관함 보관일',
  53. 'note_save_limit' => '보관함 최대개수',
  54. 'note_once_send_limit' => '동시 전송 제한 수',
  55. 'note_today_send_limit' => '하루 전송 제한 수',
  56. 'note_content_limit' => '작성 가능 글자 수'
  57. ];
  58. $posts = $this->validate($request, $rules, [], $attributes);
  59. $this->configModel->save($posts, $attributes);
  60. $message = '쪽지 정보가 저장되었습니다.';
  61. return redirect()->route('admin.config.setting.note.index')->with('message', $message);
  62. }
  63. }