TelegramController.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 TelegramController 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/telegram
  17. */
  18. public function index()
  19. {
  20. return view('admin.config.form.telegram', []);
  21. }
  22. /**
  23. * 텔레그램 양식 저장
  24. * @method POST
  25. * @see /admin/config/form/telegram
  26. */
  27. public function store(Request $request)
  28. {
  29. $rules = [
  30. 'send_telegram_crawling_form_content' => 'string|nullable', // 영화 정보 수집 시
  31. 'send_telegram_daliy_visits_form_content' => 'string|nullable' // 일 방문 통계(24시간)
  32. ];
  33. $attributes = [
  34. 'send_telegram_crawling_form_content' => '영화 정보 수집 시',
  35. 'send_telegram_daliy_visits_form_content' => '일 방문 통계(24시간)'
  36. ];
  37. $posts = $this->validate($request, $rules, [], $attributes);
  38. $this->configModel->save($posts);
  39. $message = '텔레그램 양식 정보가 저장되었습니다.';
  40. return redirect()->route('admin.config.form.telegram.index')->with('message', $message);
  41. }
  42. }