grimthorr / laravel-user-settings Goto Github PK
View Code? Open in Web Editor NEWSimple user settings facade for Laravel 5.
Simple user settings facade for Laravel 5.
Dear @Grimthorr ,
I just wanted to know, if this repository is still actively managed. The last commit is > 6 months old..
Thanks a lot for commenting and cheers,
Johannes
Currently, the SETTINGS
field in the database (or rather within the migration file) is declared as STRING
. This, however, only allows for storing max. 255 chars (at least for MySQL databases). Keep in mind, that the settings are stored as JSON object (i.e., one need additional chars for braces, commas, ...).
It would be good to change the type of the settings field in the migration file to TEXT
to store at least 65k chars!
Calling forget('key') does not set $dirty to true so the changes can't be saved (save() checks for $dirty).
In step 6 of the installation instructions in the readme file there's mentioned:
Create a varchar (string) column in a table on your database to match the config file in step 5.
.. but in fact a varchar is too short (255 chars) and text() should be used instead of string(), just like in the generated migration.
This works also fine in the ConfigServiceProvider when I do
public function boot()
{
$settings = Setting::all();
}
But I need to do this:
public function boot()
{
$settings = Setting::all($id);
}
Do you know how to get the Authenticated 'user Id' in the ConfigServiceProvider?
Hello,
Thanks very much for this package.
How would I go about getting users with a specific setting enabled?
For example my users have email preferences and I want to get all users that have promotional emails enabled.
With expansion in mind, I was thinking of creating a withSetting
scope on my users that accepted a key and value. Any ideas how I can approach this?
Thanks in advance!
Thanks for this, I'm gonna to use it.
But if current visitor is not authenticated and using Setting::get, generated SQL query will be invalid by default (settings
from users
where id = limit 1`). Wouldn't it be better / cleaner to always return default value in that case? This would avoid redundant if (Auth::check()) tests...
Thank you!
Hello,
I'm using the function setting()->get('some-option', 'some-default-string', Auth::user()->id)
inside a Blade @if()
and I'm getting the error Class setting does not exist
.
Also tried Setting::get('some-option', 'some-default-string', Auth::user()->id)
and \Setting::get('some-option', 'some-default-string', Auth::user()->id)
I've been looking into the files and found that in the vendor files from this packages, the names don't follow a standard in "Upper-case/CammelCase", let me explain myself:
In the Facade, It returns 'setting'
( also the helpers and ServiceProvider use all lowercase )
But the class is named Setting
Could this be the problem?
Also, on my mac, It works flawlessly, however in my Linux ( Ubuntu ) server does not.
Could anyone help me?
Thanks.
Turns out that my test server had the php artisan config:cache
, so I deleted the config.php
file inside bootstrap/cache
and It works again!
Hope this helps someone.
Hi,
I wanted to ask if iT is possible to change THE json datatype to text or something else?
Because apparently the databases from my webhosting are mariadb and dont support JSON datatype.
I was using this LocalLy and I love this package but cant JSON for my actual website.
Wanted so to ask if TEXT would be possible?
After using Setting::forget($key)
Undefined offset: 1 on Setting.php line 106
-> return array_get($this->settings[$constraint_value], $key, $default);
and setting still remain its values.
I get array_key_exists() expects parameter 2 to be array, null given
, when using Setting::has()
in case when settings column has no value. Setting::all($user->id)
returns null
. It is not possible to set a default value of []
to a TEXT
column. I think the package should check if the column is empty, as it overwrites the $settings
property in the Setting
class (at least it seems to).
setting()->all()
and setting()->all($id)
These only work when the id is an integer.
Can you add support for string GUID/UUIDs because currently I have to do this:
setting()->all("'$id'")
[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'Grimthorr\LaravelUserSettings\ServiceProvider' not found
Note: If you receive a "class not found" error when running migrations, try running the composer dump-autoload command.
composer dump-autoload its not fixing this issue, on L5
any recommendations?
I know this project isn't really being actively maintained anymore and that it's been forked. But given that there is still usage of it, would you be willing to set a license for it?
Thanks.
Is it possible to have them stored/retrieved as booleans or do they have to be saved as strings?
Hi, this package looks pretty interesting, although I can not find a way to get the settings for a specific user, something like this.
$user->settings;
Any thoughts?
The packages register both as 'setting' in the app.
Is there a way to solve this issue locally or they can't coexist?
This is new.
'ErrorException' with message 'json_decode() expects parameter 1 to be string, array given' in /home/vagrant/Code/maple/vendor/grimthorr/laravel-user-settings/src/Setting.php:227
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.