<?php

namespace App\Http\Controllers\Admin;

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

class CompanyStateHeroController extends Controller
{
    function index()
    {
        $data = CompanyStateHero::first();
        return view('admin.companystate.index', compact('data'));
    }

    function update(Request $request)
    {

        $request->validate([
            'title' => ['required'],
            'description1' => ['required'],
            'description2' => ['required']
        ]);


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

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