@martinbean one more question actually :) Hope you don't mind.
So, I've added this to User:
/**
* get UI setting for user
* @param $key
* @param null $default
* @return mixed
*/
public function setting($key, $default = null)
{
return data_get($this->settings, $key, $default);
}
This I assume would be how I get the settings wherever I need them?
$resultsPerPage = Auth::user()->setting('results_per_page') ?? 15;
But what would be the best way to actually save/update these settings?
So I have my partial view
results-per-page.blade.php:
<form method="post" action="">
<div class="input-field col s12">
<select name="results_per_page">
<option value="15">15</option>
<option value="50">50</option>
<option value="100">100</option>
<option value="250">250</option>
<option value="500">500</option>
<option value="1000">1000</option>
</select>
<label>Results Per Page</label>
</div>
</form>
Would I now make it a middleware that basically listens to POST requests and updates all the settings whenever a user makes a change, or also add it to the User class and explicitly write code in all controllers to update whatever settings the current view has?
Or is there an even better/easier solution I'm not seeing here :)
Thanks!