mirror of
https://github.com/cp6/my-idlers.git
synced 2024-11-17 07:52:40 +01:00
a314ac99ef
Initial v2 commit Laravel project
57 lines
2.1 KiB
PHP
57 lines
2.1 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Models\Settings;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\DB;
|
|
use Illuminate\Support\Facades\Session;
|
|
|
|
class SettingsController extends Controller
|
|
{
|
|
public function index()
|
|
{
|
|
$setting = DB::table('settings')
|
|
->where('id', '=', 1)
|
|
->get();
|
|
|
|
return view('settings.index', compact(['setting']));
|
|
}
|
|
|
|
public function update(Request $request, Settings $settings)
|
|
{
|
|
$request->validate([
|
|
'show_versions_footer' => 'required|boolean',
|
|
'show_server_value_ip' => 'required|boolean',
|
|
'show_server_value_hostname' => 'required|boolean',
|
|
'show_server_value_provider' => 'required|boolean',
|
|
'show_server_value_location' => 'required|boolean',
|
|
'show_server_value_price' => 'required|boolean',
|
|
'show_server_value_yabs' => 'required|boolean'
|
|
]);
|
|
|
|
DB::table('settings')
|
|
->where('id', 1)
|
|
->update([
|
|
'show_versions_footer' => $request->show_versions_footer,
|
|
'show_servers_public' => $request->show_servers_public,
|
|
'show_server_value_ip' => $request->show_server_value_ip,
|
|
'show_server_value_hostname' => $request->show_server_value_hostname,
|
|
'show_server_value_provider' => $request->show_server_value_provider,
|
|
'show_server_value_location' => $request->show_server_value_location,
|
|
'show_server_value_price' => $request->show_server_value_price,
|
|
'show_server_value_yabs' => $request->show_server_value_yabs
|
|
]);
|
|
|
|
Session::put('timer_version_footer', $request->show_versions_footer);
|
|
Session::put('show_servers_public', $request->show_servers_public);
|
|
Session::put('show_server_value_ip', $request->show_server_value_ip);
|
|
Session::put('show_server_value_hostname', $request->show_server_value_hostname);
|
|
Session::save();
|
|
|
|
return redirect()->route('settings.index')
|
|
->with('success', 'Settings Updated Successfully.');
|
|
}
|
|
|
|
}
|