Laravel Community Tools by Tighten

Recent tricks

458 tricks
Apache server configuration files
yuchao 11 years ago 7453
4.0
You can use this when you want to add a placeholder to your Form::selectRange or Form::selectMonth.
soffan 11 years ago 11408
Since Eloquent doesn't do a real join when using "with" this will add a simple join method without having to worry about the join columns since it's all stored with the models anyway. It will also select all the columns from the joined table with an added prefix of the table name.
phazei 11 years ago 45232
When you need to pass some data to the Mail::send or Mail::queue, you need to make use of the "use" approach:
aglipanci 11 years ago 56037
If we have a blog, sometimes we want to display all latest posts by category. Take an example with this website where I put those posts in a carousel on the homepage: http://dadack.com
mercuryser... 11 years ago 17555
If you want to redirect all HTTP traffic to HTTPS (SSL) you can use this method. However, note that this may NOT work out of the box if you are behind CloudFlare/load balancer/reverse proxy unless you set a trusted proxy, more info here: http://www.laravel-tricks.com/tricks/fix-ssl-in-laravel-4-when-server-is-behind-a-load-balancer-or-a-reverse-proxy
zOxta 11 years ago 32840
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 25089
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 10743
This scope function applies a callback to the elements of a given query collection.
jplozano 11 years ago 9158