<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\SettingBillingCharge;

class SettingBillingChargeController extends Controller
{
    public function index()
    {
        $billing_charge_setting = SettingBillingCharge::latest()->first();
        return response()->json($billing_charge_setting, 201);
    }

    public function update(Request $request)
    {
        if($billing_charge_setting = SettingBillingCharge::latest()->first())
            $billing_charge_setting->update($request->all());
        else
            $billing_charge_setting = SettingBillingCharge::create($request->all());

        return response()->json($billing_charge_setting, 200);
    }
}
