gruene-seele/app/Http/Controllers/SettingController.php
2021-01-15 18:16:31 +01:00

54 lines
No EOL
960 B
PHP
Executable file

<?php
namespace App\Http\Controllers;
use App\Models\Category;
use App\Models\Ingredient;
use App\Models\IqImage;
use App\Models\ProductCategory;
use App\Models\ProductIngredient;
use App\Models\Setting;
use Request;
class SettingController extends Controller
{
public function __construct()
{
$this->middleware('admin');
}
public function index()
{
$data = [
'values' => Ingredient::all(),
];
return view('admin.settings.index', $data);
}
public function store()
{
$data = Request::all();
if(isset($data['action'])){
if(isset($data['settings'])){
foreach ($data['settings'] as $key=>$value){
Setting::setContentBySlug($key, $value['val'], $value['type']);
}
}
}
\Session()->flash('alert-save', '1');
return redirect(route('admin_settings'));
}
}