<?php

namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
use App\Models\GuideFaq;
use Illuminate\Http\Request;

class GuideFaqController extends Controller
{
    function __construct()
    {
        $this->middleware('role_or_permission:guide faq section', ['only' => ['index', 'update']]);
    }

    function index()
    {
        $data = GuideFaq::first();
        return view('admin.guide.faq.index', compact('data'));
    }

    function update(Request $request)
    {

        GuideFaq::query()->UpdateOrCreate([
            'id' => 1
        ], [
            'content' => $request->content
        ]);

        $notification = array(
            'messege' => 'Updated successfully',
            'alert-type' => 'success'
        );
        return back()->with($notification);
    }
}
