<?php

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

class PrivacyPolicyController extends Controller
{
    ##UPDATE
    public function updateprivacypolicy(Request $request){
        $validate           =   $request->validate([
            'privacy_policy_description'     => 'required',
        ]);
        $update             =  PrivacyPolicy::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 getprivacypolicy(){
        $getdata     = PrivacyPolicy::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);
        }
    }
}
