<?php

namespace App\Http\Controllers\Backend;

use App\Http\Controllers\Controller;
use App\Models\ActionPerameter;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Contracts\View\Factory;
use Illuminate\Contracts\View\View;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;

class ActionPerameterController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return Application|Factory|View
     */
    public function index()
    {
        return view('backend.action-perameter.index');
    }

    /**
     * @param Request $request
     * @return RedirectResponse
     */
    public function update(Request $request): RedirectResponse
    {
        $keys = $request->except('_token');
        foreach ($keys as $key => $value)
        {
            ActionPerameter::set($key, $value);
        }
        return redirect()->back()->with([ 'alert-type' => 'success','message' => 'Action Perameter updated successfully']);

    }
}
