37 lines
1.1 KiB
PHP
37 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Admin\Setting;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Http\Requests\Admin\Setting\UpdateAppearanceRequest;
|
|
use Illuminate\Http\RedirectResponse;
|
|
use Inertia\Inertia;
|
|
use Inertia\Response;
|
|
use Symfony\Component\HttpFoundation\Cookie;
|
|
|
|
class AppearanceController extends Controller
|
|
{
|
|
public function edit(): Response
|
|
{
|
|
return Inertia::render('admin/setting/Appearance', [
|
|
'appearance' => request()->cookie('appearance', 'system'),
|
|
]);
|
|
}
|
|
|
|
public function update(UpdateAppearanceRequest $request): RedirectResponse
|
|
{
|
|
$appearance = $request->string('appearance')->toString();
|
|
|
|
Inertia::flash('success', 'Tampilan berhasil diperbarui.');
|
|
|
|
return redirect()
|
|
->route('admin.setting.appearance')
|
|
->withCookie(Cookie::create('appearance')
|
|
->withValue($appearance)
|
|
->withExpires(now()->addYear())
|
|
->withPath('/')
|
|
->withHttpOnly(false)
|
|
->withSameSite('lax'));
|
|
}
|
|
}
|