Laravel Community Tools by Tighten

Category "Configuration" tricks

45 tricks
If you are running Laravel 4 and behind a load balancer or a reverse proxy, some HTTPS functions like ‘Request::secure()’ and ‘Request::isSecure()’ will return false. If we add the current IP which belongs to the proxy/load balancer to the setTrustedProxies then the Request class will honour the ‘X-Forwarded-Proto’ and other ‘X-Forwarded’ headers and the mentioned functions would work fine. Note: THIS METHOD CANNOT BE TRUSTED unless ALL requests go through a proxy YOU control.
zOxta 11 years ago 25068
If you are running Laravel 4 behind Cloudflare over HTTPS some functions like ‘Request::secure()’ and ‘Request::isSecure()’ will return false. By using the setTrustedProxies method of the Request facade we can add the Cloudflare IP ranges to trust, thus the Request class will honor the ‘X-Forwarded-Proto’ and other ‘X-Forwarded’ headers.
zOxta 11 years ago 10728
Hi All, I am trying to run laraverl-tricks open source application locally, but for some reason it is not running locally If anybody successfully run this app, please let me know, Thanks all
l4friend 11 years ago 7967
4.0
This snippet will explain how to use environment variables to configure your environment. Blog post: http://dor.ky/laravel-homestead-add-enviroment-variables-to-nginx/
ssx 11 years ago 12869
4.1
This filter will prevent the route from having sessions enabled. Very useful for API calls and when you don't want sessions starting. Blog Post: http://dor.ky/laravel-prevent-sessions-for-routes-via-a-filter/
ssx 11 years ago 11292
Loading views from a different location, other than 'app/views'
Whyounes 11 years ago 9521
This is a simple trick that laravel run on IIS Server, this configuration will delete the public folder from the URL, but does not delete the public folder in the application. I was inspired by a trick-owned https://gist.github.com/leabdalla/6135627, but it can not load css, js, routing and other files. And I have experimented that overall laravel can run normally. this is my simple code, I put web.config in the root folder, and I did not change any of the main application, especially in public folders.
cyberid41 11 years ago 20113
4.1
Sometimes you need to use some packages based on the environment in which the application is running in, for example "development". You can append environment service providers and aliases in your development configuration file "app/config/development/app.php" with the "append_config" helper method.
hosmelq 11 years ago 8972
4.1
To setup configuration according to each environment you can set environmental variables. In this below example I am setting up an environmental variable "LARAVEL_ENV" with below values. staging as LARVEL_ENV staging production as LARVEL_ENV production Then in start.php under detect environment add the below code for getting the environment. You can add config files under respective folders.
ashwin-sur... 12 years ago 9863