<?php

namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;

class FeeAndChargeController extends Controller
{
    public function index()
    {
        $pageTitle = 'Fee & Charge';
        return view('admin.setting.fee_and_charge', compact('pageTitle'));
    }

    public function update(Request $request)
    {
        $request->validate([
            'card_issue_fee'     => 'required|numeric|min:0',
            'yearly_card_charge' => 'required|numeric|min:0',
        ]);

        $general                     = gs();
        $general->card_issue_fee     = $request->card_issue_fee;
        $general->yearly_card_charge = $request->yearly_card_charge;
        $general->save();

        $notify[] = ['success', 'Stripe configuration updated successfully'];
        return back()->withNotify($notify);
    }
}
