-
Notifications
You must be signed in to change notification settings - Fork 99
Database data source #36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
74adea8 to
9e68738
Compare
|
If the Trait is not added to the User model then how will it be able to call |
|
So if we have a special data source of |
|
@jamesmills Yep, I was thinking about that too. I think this feature has to be added as a new version. since it might bring break change. Since that trait, it will be mandatory. @nyalex If this became a new version, you have to update your composer to pull this new version, and add this trait into the resource model, which usually is the |
9e68738 to
d7f3069
Compare
|
Did some changes. Implementation still the same, but I tried to be more clear on the installation. |
|
Love this conversation. Thanks all for contributing. I’m confused why this would be a breaking change. The Trait would allow the developer to override the default column name or model where the timezone is set. That’s great. But if the Trait was not on the User model then.... ahhhhhhh hang on.... I was just about to say we can use a default method but we cannot because the package doesn’t have this. Ok, so. Option 1. Option 2. Thoughts? |
|
@jamesmills I prefer the 2 option ;) |
|
@jamesmills I agree that option 2 is better. I'm currently working on a project where I have 3 different user models, none of which are App\User and I'm doing an extra round trip on several pages, getting the timezone from the browser, and using that to adjust for local time. This would be a better way to go because it would eliminate that extra round trip, but it would need to be a trait so I can apply it to each model and store the data in a way that makes sense for me. |
|
I also having same problem.I am not using users table to store users data so in that case i need some configuration to set users table name and field column name or external command to get timezone. |
|
I'm guessing that we can just add a |
|
actually been thinking about this a little more. I think we should continue with the Could we then not include the Cast into the Trait? https://github.com/jamesmills/laravel-timezone/pull/35/files So that you don't have to manually add the cast yourself as it would be added by the Trait if you decide to use the Trait? So the recommended way to use the package is to use the Trait on your User Model/Models. Then you get the ability to override where you get the timezone from and you automatically get the casting. Gah! |
|
Hi, just curious if anyone has tried making custom accessor and mutator on the model ( |
|
Hi, all! 👋🏻 First of all, thanks for the package. =) I browsed through the issues and found this pull request, as it seemed odd for my use-case to have to run migrations and rely on the database to store the current user's timezone. I only need to guess the user's timezone (maybe keep it in the session if it's too expensive to repeatedly get it), but I have no need for the user to keep or modify settings throughout sessions. Would the Trait or Accessor serve for this? I'm trying to wrap my head around the current state of this package, as it seems there's a super-simple use-case for this package which doesn't require the use of migrations, database, user model, and flash messages. Anyway, thanks again for open-sourcing this and for the time put to develop this piece of software. Best! Nono |
#32