Created
November 21, 2021 16:06
-
-
Save ticituc/2a15333f0c87c1dac81f2f259971cba1 to your computer and use it in GitHub Desktop.
This is the Setting controller for SOLID-refaktor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Controllers\Admin\System; | |
use App\Enum\AdminRoutes; | |
use App\Http\Controllers\Controller; | |
use App\Http\Requests\Admin\SettingsRequest; | |
use App\Model\Setting; | |
class SettingsController extends Controller | |
{ | |
public function index() | |
{ | |
$this->breadcrumbs->add(__('admin.system.navigation.settings')); | |
return view('admin.pages.system.settings.index'); | |
} | |
public function store(SettingsRequest $request) | |
{ | |
foreach ($request->settings as $id => $value) { | |
Setting::find($id)->fill(['value' => $value])->save(); | |
} | |
return redirect()->route(AdminRoutes::SYSTEM_SETTINGS); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment