<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\SettingTaxRate;

class SettingTaxRateController extends Controller
{
	public function index()
	{
	    $setting_tax = SettingTaxRate::latest()->first();
	    return response()->json($setting_tax, 201);
	}

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

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