<?php

namespace App\Http\Controllers\Admin\Setting;

use App\Http\Controllers\Controller;
use App\Http\Requests\Admin\Setting\ApplicationRequest;
use App\Models\Setting;
use Illuminate\Contracts\View\View;
use Illuminate\Http\RedirectResponse;

class ApplicationController extends Controller
{
    public function index(): View
    {
        return view('pages.admin.setting.application', [
            'pageTitle' => 'Aplikasi',
            'application' => Setting::with('attachment')->first(),
        ]);
    }

    public function update(Setting $setting, ApplicationRequest $request): RedirectResponse
    {
        $validatedData = $request->validated();
        $setting->update($validatedData);

        notify()->success('Data berhasil diperbarui', 'Berhasil');

        return back();
    }
}
