<?php

namespace App\Http\Controllers;

use App\Models\Terms;
use Illuminate\Http\Request;

class TermsController extends Controller
{
    public function index()
    {
        $termspage = Terms:: Where('delete_status', '0')->first();
        return view('backend.terms.index', compact('termspage') );
    }

    public function store(Request $request)
    {

        $termspage=$request->all();

        Terms::create($termspage);

        return redirect()->route('terms.index')
        ->with('success','Terms Updated successfully.');
    }

    public function edit(Terms $termspage)
    {
        return view('backend.terms.index',compact('termspage'));
    }

    public function update(Request $request, $id)
    {

        $termspage = Terms::find($id);
        $input=$request->all();

        $termspage->update($input);

        return redirect()->route('terms.index')
        ->with('success','Terms Updated successfully.');

    }
}
