2022-09-30 18:22:00 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
|
2022-10-04 15:25:06 +02:00
|
|
|
use App\Http\Requests\App\SubmitRequest;
|
|
|
|
|
use App\Models\Directories;
|
|
|
|
|
use App\Models\Setting;
|
2022-09-30 18:22:00 +02:00
|
|
|
|
|
|
|
|
class AppController extends Controller
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* Index
|
|
|
|
|
*
|
|
|
|
|
* @return \Illuminate\Contracts\View\View
|
|
|
|
|
*/
|
|
|
|
|
public function index()
|
|
|
|
|
{
|
2022-10-04 15:25:06 +02:00
|
|
|
$button_1 = Setting::where('key', 'Button1')->first()->only('value');
|
|
|
|
|
$button_2 = Setting::where('key', 'Button2')->first()->only('value');
|
|
|
|
|
$button_3 = Setting::where('key', 'Button3')->first()->only('value');
|
|
|
|
|
|
|
|
|
|
return view('app.index', [
|
|
|
|
|
'directories' => Directories::where('parent', \null)->where('id', '<>', 1)->orderBy('order', 'ASC')->get(),
|
|
|
|
|
'button_1' => \intval($button_1['value']),
|
|
|
|
|
'button_2' => \intval($button_2['value']),
|
|
|
|
|
'button_3' => \intval($button_3['value'])
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Submit
|
|
|
|
|
*
|
|
|
|
|
* @param \App\Http\Requests\App\SubmitRequest $request
|
|
|
|
|
* @return redirect
|
|
|
|
|
*/
|
|
|
|
|
public function submit(SubmitRequest $request)
|
|
|
|
|
{
|
|
|
|
|
Setting::where('key', 'Button1')->update(['value' => $request->button_1]);
|
|
|
|
|
Setting::where('key', 'Button2')->update(['value' => $request->button_2]);
|
|
|
|
|
Setting::where('key', 'Button3')->update(['value' => $request->button_3]);
|
|
|
|
|
|
|
|
|
|
return redirect()->route('app.index')->with('status', __("Configuration sauvegardée."));
|
2022-09-30 18:22:00 +02:00
|
|
|
}
|
|
|
|
|
}
|