2020-02-27 12:18:46 +01:00
|
|
|
<?php
|
|
|
|
|
2020-03-09 20:24:25 +01:00
|
|
|
namespace App\Http\Controllers\Settings;
|
2020-02-27 12:18:46 +01:00
|
|
|
|
2020-03-13 22:10:36 +01:00
|
|
|
use App\Classes\Options;
|
2020-02-27 12:18:46 +01:00
|
|
|
use Illuminate\Http\Request;
|
2020-03-03 22:09:06 +01:00
|
|
|
use App\Http\Controllers\Controller;
|
2020-02-27 12:18:46 +01:00
|
|
|
|
2020-03-09 20:24:25 +01:00
|
|
|
class OptionController extends Controller
|
2020-02-27 12:18:46 +01:00
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get options
|
|
|
|
* @return [type] [description]
|
|
|
|
*/
|
|
|
|
public function index()
|
|
|
|
{
|
|
|
|
// Fetch all setting values
|
2020-03-13 22:10:36 +01:00
|
|
|
$settings = Options::get();
|
2020-02-27 12:18:46 +01:00
|
|
|
|
|
|
|
return response()->json(['settings' => $settings], 200);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Save options
|
|
|
|
* @return [type] [description]
|
|
|
|
*/
|
|
|
|
public function store(Request $request)
|
|
|
|
{
|
2020-03-13 22:10:36 +01:00
|
|
|
// Store all options
|
|
|
|
Options::store($request->all());
|
2020-02-27 12:18:46 +01:00
|
|
|
|
2020-03-13 22:10:36 +01:00
|
|
|
return response()->json(['message' => __('settings.forms.setting_saved'), 'settings' => Options::get()], 200);
|
2020-02-27 12:18:46 +01:00
|
|
|
}
|
|
|
|
}
|