kuvia/app/Http/Controllers/AdminController.php

33 lines
1.1 KiB
PHP
Raw Normal View History

2021-01-21 17:56:30 +00:00
<?php
namespace App\Http\Controllers;
use App\Models\Theme;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Support\Facades\Redirect;
class AdminController extends BaseController
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
public function themesView() {
$themes = Theme::query()->get();
return view("admin.themes", ["themes" => $themes]);
}
public function themesSettings(Request $request) {
$theme = Theme::query()->where("id", "=", $request->input("id"))->firstOrFail();
$theme->status = $request->input("status");
$theme->img_big = (bool)$request->input("img_big", false);
$theme->img_medium = (bool)$request->input("img_medium", false);
$theme->img_small = (bool)$request->input("img_small", false);
$theme->img_pixel = (bool)$request->input("img_pixel", false);
$theme->saveOrFail();
return Redirect::back();
}
}