<?php

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

class ReturnPolicyController extends Controller
{
    ##UPDATE
    public function updatereturnpolicy(Request $request){
        $validate           =   $request->validate([
            'return_policy_description'     => 'required',
        ]);
        $update             =  ReturnPolicy::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 getreturnpolicy(){
        $getdata     = ReturnPolicy::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);
        }
    }
}
