In your get function
$mylist = config('mylist'); /config/mylist.php
return view('...',compact('mylist'));
In your post function
foreach ($request->except("_token") as $key => $value) {
Config::set('mylist.' . $key, $value);
}
$text = '<?php return ' . var_export(config('mylist'), true) . ';';
file_put_contents(config_path('mylist.php'), $text);
In blade
<form action=" " method="post">
@csrf
@foreach ($mylist as $key => $value)
<div class="form-group">
<textarea name="{{$key}}" class="form-control" rows="4">{{$value}}</textarea>
</div>
@endforeach
<div class="form-group">
<button type="submit" class="btn btn-success"> {{ __('Save') }} </button>
</div>
</form>
Top comments (0)