<?php

namespace App\Http\Controllers;
use App\Models\RefundPolicy;
use Illuminate\Http\Request;

class RefundPolicyController extends Controller
{
    ##UPDATE
    public function updaterefundpolicy(Request $request){
        $validate           =   $request->validate([
            'refund_policy_description'     => 'required',
        ]);
        $update             =  RefundPolicy::first()->update($request->all());
        if ($update == true) {
            return response()->json(['status' => true,'message'=>'update Success'],200);
        }else{
            return response()->json(['status' => false,'message'=>'failed update'],400);
        }
    }

    ##GET
    public function getrefundpolicy(){
        $getdata     = RefundPolicy::all();
        if ($getdata == true){
            return response()->json(['success' => true, 'message' => 'Social media Records', 'Records' => $getdata], 200);
        } else {
            return response()->json(['status' => false,'data' => 'failed data'], 400);
        }
    }
}
