Allow settings to be overridden in request

This commit is contained in:
Cram42 2022-11-02 19:30:45 +08:00
parent 48fb4f2439
commit 36210f1c6a

View file

@ -61,9 +61,17 @@ class LabelsController extends Controller
$testAsset->model->category->id = 999999; $testAsset->model->category->id = 999999;
$testAsset->model->category->name = 'Test Category'; $testAsset->model->category->name = 'Test Category';
$settings = Setting::getSettings();
if (request()->has('settings')) {
$overrides = request()->get('settings');
foreach ($overrides as $key => $value) {
$settings->$key = $value;
}
}
return (new LabelView()) return (new LabelView())
->with('assets', collect([$testAsset])) ->with('assets', collect([$testAsset]))
->with('settings', Setting::getSettings()) ->with('settings', $settings)
->with('template', $template) ->with('template', $template)
->with('bulkedit', false) ->with('bulkedit', false)
->with('count', 0); ->with('count', 0);