| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- <?php
- namespace App\Http\Controllers\Admin\Config\Setting;
- use Illuminate\Http\Request;
- use App\Http\Controllers\Controller;
- use App\Models\Config;
- use App\Models\User;
- class BasicController extends Controller
- {
- private Config $configModel;
- private User $userModel;
- public function __construct(Config $config, User $user)
- {
- $this->configModel = $config;
- $this->userModel = $user;
- }
- /**
- * 기본
- * @method GET
- * @see /admin/config/setting/basic
- */
- public function index()
- {
- // 관리자 회원
- return view('admin.config.setting.basic', [
- 'admins' => $this->userModel->getAdmins()
- ]);
- }
- /**
- * 기본 저장
- * @method POST
- * @see /admin/config/setting/basic
- */
- public function store(Request $request)
- {
- $rules = [
- 'admin_title' => 'string|nullable',
- 'site_title' => 'string|nullable',
- 'master_key' => 'string|nullable',
- 'master_email' => 'email|nullable',
- 'master_name' => 'string|nullable',
- 'footer_script' => 'string|nullable|max:2000',
- 'spam_word' => 'string|nullable',
- 'white_iframe' => 'string|nullable|max:2000',
- 'ip_display_style' => 'string|nullable',
- 'new_post_second' => 'required|numeric|min:0',
- 'open_current_visitor' => 'nullable|numeric',
- 'current_visitor_minute' => 'required|numeric|min:0',
- 'cache_expire_time' => 'required|numeric|min:1|max:86400',
- 'verify_expires_at' => 'required|numeric|min:1|max:3600',
- 'verify_send_limit' => 'required|numeric|min:0',
- 'use_post_copy_log' => 'required|numeric|in:0,1',
- 'use_header_search_log' => 'required|numeric|in:0,1'
- ];
- $attributes = [
- 'admin_title' => '관리자 제목',
- 'site_title' => '홈페이지 제목',
- 'master_key' => '최고관리자',
- 'master_email' => '관리자 이메일',
- 'master_name' => '관리자 이메일 이름',
- 'footer_script' => '하단 Script',
- 'spam_word' => '금지 단어',
- 'white_iframe' => '허용 Iframe',
- 'ip_display_style' => 'IP 공개시 표시 형식',
- 'new_post_second' => '새로운 글쓰기 시간',
- 'open_current_visitor' => '현재 접속자 공개 여부',
- 'current_visitor_minute' => '현재 접속자 기준',
- 'cache_expire_time' => '캐시 생성 시간',
- 'verify_expires_at' => '인증번호 만료시간',
- 'verify_send_limit' => '인증번호 발송 분당 제한 수',
- 'use_post_copy_log' => '게시물 이동 및 복사 기록',
- 'use_header_search_log' => '검색기록 저장 여부'
- ];
- $posts = $this->validate($request, $rules, [], $attributes);
- $this->configModel->save($posts, $attributes);
- $message = '기본 정보가 저장되었습니다.';
- return redirect()->route('admin.config.setting.basic.index')->with('message', $message);
- }
- }
|