<?php

namespace App\Http\Controllers;


use Illuminate\Http\Request;
use App\Models\HrCoils;
use App\Repositories\ResponseRepository;
use Illuminate\Support\Facades\Log;

class HrCoilsController extends Controller
{
    //
    public function __construct(ResponseRepository $response) {
        $this->response = $response;
        $this->storeRules = [
            'hr_main_title' => 'required',
            'hr_sub_title' => 'required',
            'hr_description' => 'required',
        ];
    }
    
    public function getHrCoils() {
        return $this->response->jsonResponse(false, "Hr Coils Content Fetched Successfully", HrCoils::all(), 550);
    }

    public function updateHrCoils(Request $request) {
        $validate = $this->response->validate($request->all(), $this->storeRules);
        if($validate === true) {
            return $this->response->jsonResponse(false, $this->response->message('Hr Coils Content', 'update'), HrCoils::first()->update($request->all()), 551);
        } else {
            return $this->response->jsonResponse(true, 'Hr Coils Content Update Failed', $validate, 552);
        }
    }


}
