Skip to content
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

How to make global variables ? #38

Open
mridah opened this issue Jan 21, 2017 · 2 comments
Open

How to make global variables ? #38

mridah opened this issue Jan 21, 2017 · 2 comments

Comments

@mridah
Copy link

mridah commented Jan 21, 2017

is there a way I can declare constants somewhere so I can just use them in my controllers ? @akrabat @namaless @needcaffeine @jeremykendall

@nunocodex
Copy link
Contributor

@mridah Isn't the best place where ask support to this. Btw you can define constants where you want, but for me you can define what you want in the container and then you have where you need.

@lferro9000
Copy link

Additionally, if you want to define constants for use on all your controllers, the best way would be to have them all extend a base class that only defines class constants and use them within your controllers. That way, you keep those constants inside your context (aka the controllers).

Just remember that if you start to have too many constants etc, you may be disguising mutations and the like with them, so make sure you don't have overcomplicated switch / if/then/else structures as they are normally a give-away of the need to a better structure in your code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants