Skip to content

Instantly share code, notes, and snippets.

@tderick
Created August 30, 2022 01:55
Show Gist options
  • Save tderick/15a0790c9a5efaae0e17c75e3ddc0fe8 to your computer and use it in GitHub Desktop.
Save tderick/15a0790c9a5efaae0e17c75e3ddc0fe8 to your computer and use it in GitHub Desktop.
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Parameters;
class ParametersController extends Controller
{
public function index()
{
$parameters = Parameters::where('id', 1)->first();
return view('parameters', compact('parameters'));
}
public function save_parameter(Request $request)
{
if (isset($request->all()['email-notification'])) {
$data['is_email_notification_actived'] = 1;
Parameters::where('id', 1)->update($data);
} else {
$data['is_email_notification_actived'] = 0;
Parameters::where('id', 1)->update($data);
}
return redirect("/admin/settings")->with("status", "Your parameters have been saved");;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment