2025-07-10 11:01:01 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
|
|
|
|
|
use App\Models\Setting;
|
2025-07-10 11:24:48 +02:00
|
|
|
use Illuminate\Contracts\View\View;
|
|
|
|
|
use Illuminate\Http\RedirectResponse;
|
2025-07-10 11:01:01 +02:00
|
|
|
use Illuminate\Http\Request;
|
|
|
|
|
|
|
|
|
|
class SettingsController extends Controller
|
|
|
|
|
{
|
2025-07-10 11:24:48 +02:00
|
|
|
public function index(): View
|
2025-07-10 11:01:01 +02:00
|
|
|
{
|
|
|
|
|
$articleProcessingEnabled = Setting::isArticleProcessingEnabled();
|
|
|
|
|
|
|
|
|
|
return view('pages.settings.index', compact('articleProcessingEnabled'));
|
|
|
|
|
}
|
|
|
|
|
|
2025-07-10 11:24:48 +02:00
|
|
|
public function update(Request $request): RedirectResponse
|
2025-07-10 11:01:01 +02:00
|
|
|
{
|
|
|
|
|
$request->validate([
|
|
|
|
|
'article_processing_enabled' => 'boolean',
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
Setting::setArticleProcessingEnabled($request->boolean('article_processing_enabled'));
|
|
|
|
|
|
|
|
|
|
return redirect()->route('settings.index')
|
|
|
|
|
->with('success', 'Settings updated successfully.');
|
|
|
|
|
}
|
|
|
|
|
}
|