Giter Site home page Giter Site logo

laravel-user-settings's People

Contributors

balping avatar grimthorr avatar johannesschobel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

laravel-user-settings's Issues

Change SETTINGS type from STRING to TEXT

Currently, the SETTINGSfield 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!

Readme should suggest text instead of varchar

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.

Use a scope to get users with a setting?

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!

SQL Syntax error if user is not authenticated

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!

Update package to support Laravel 5

  1. Fix package for laravel 5.
  2. Migrate existing Laravel 4 source to a separate branch.
  3. Merge Laravel 5 support into master.
  4. Release version 2.0 with Laravel 5 support.

Class setting does not exist

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.

UPDATE

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.

No Json supported. Can you change to text or provide alternative?

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?

Laravel 6 Support?

Hi! When I try to upgrade an existing project to Laravel 6, this occurs:

image

Hope you could update the package to support Laravel 6.

Thanks!

Setting::forget Not working

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.

Empty column error

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).

Support for GUID/UUIDs

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'")

ServiceProvider not found

[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?

Set a license for the project

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.

How to get Settings from specific user?

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?

Laravel 5.2 Error

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.