jamesmills / laravel-timezone

Enable user Timezones in your application.
MIT License
678 stars 91 forks source link

Usage of protected instead of private function #58

Open oza75 opened 3 years ago

oza75 commented 3 years ago

https://github.com/jamesmills/laravel-timezone/blob/20ea12b088909c3dfadf6de8ae961c367a77b668/src/Timezone.php#L51

I'm wondering, if we can use protected instead of private function then people can easily extends the Timezone and customize to their need.

Also, Can we extract the obtaining of the time zone in another class which will be responsible for assigning the time zone to the user (the user could be passed in the constructor and if not then we will use the Auth::user() )?

This will allow us to assign the time zone to the user without necessarily listening to the authentication event. https://github.com/jamesmills/laravel-timezone/blob/20ea12b088909c3dfadf6de8ae961c367a77b668/src/Listeners/Auth/UpdateUsersTimezone.php#L50

jamesmills commented 3 years ago

I'm wondering, if we can use protected instead of private function then people can easily extends the Timezone and customize to their need.

@oza75 do you still require this?

jamesmills commented 3 years ago

Can we extract the obtaining of the time zone in another class which will be responsible for assigning the time zone to the user

@oza75 I'm wondering if this https://github.com/jamesmills/laravel-timezone/pull/36 is going to help with that? It's still being worked on but I think we will release an update soon.