| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- <?php
- namespace App\Http\Controllers\Admin\Config\Layout;
- use Illuminate\Http\Request;
- use App\Http\Controllers\Controller;
- use App\Models\Config;
- class MetaController extends Controller
- {
- private Config $configModel;
- public function __construct(Config $config)
- {
- $this->configModel = $config;
- }
- /**
- * 메타 태그
- * @method GET
- * @see /admin/config/layout/meta
- */
- public function index()
- {
- return view('admin.config.layout.meta', []);
- }
- /**
- * 메타 태그 저장
- * @method POST
- * @see /admin/config/layout/meta
- */
- public function store(Request $request)
- {
- $rules = [
- 'meta_keywords' => 'string|nullable|max:500',
- 'meta_description' => 'string|nullable|max:500',
- 'meta_author' => 'string|nullable|max:500',
- 'meta_viewport' => 'string|nullable|max:500',
- 'meta_application_name' => 'string|nullable|max:500',
- 'meta_generator' => 'string|nullable|max:500',
- 'meta_robots' => 'string|nullable|max:500',
- 'meta_adds_info' => 'string|nullable|max:2000'
- ];
- $attributes = [
- 'meta_keywords' => 'Meta keywords',
- 'meta_description' => 'Meta description',
- 'meta_author' => 'Meta author',
- 'meta_viewport' => 'Meta viewport',
- 'meta_application_name' => 'Meta Application Name',
- 'meta_generator' => 'Meta Generator',
- 'meta_robots' => 'Meta Robots',
- 'meta_adds_info' => 'Meta Adds Info'
- ];
- $posts = $this->validate($request, $rules, [], $attributes);
- $this->configModel->save($posts, $attributes);
- $message = '메타 정보가 저장되었습니다.';
- return redirect()->route('admin.config.layout.meta.index')->with('message', $message);
- }
- }
|