How to Set S3 ContentType and Other Request Headers with Laravel Filesystem / Cloud Storage

Laravel 5 brought to the table a powerful Storage Facade that allowed developers to easily integrate any kind of storage system into an application. Amazon S3, being a Laravel native supported Filesystem, makes it easy to upload large files directly from the application to cheap and reliable storage. S3 supports many types of request headers […]

How to Fix Laravel HTTPS Redirect Loop on Amazon Elastic Beanstalk/Load Balancer/Proxy

If you are forcing HTTPS on routes in Laravel but are having issues with a redirect loop and your app is behind a proxy, load balancer, or something like Elastic Beanstalk, try adding this to your .htaccess file: #Fixes HTTPS Redirect Loop SetEnvIfNoCase X-FORWARDED-PROTO “^https$” HTTPS Many load balancers will accept HTTPS traffic and forward […]

How to Get Laravel Task Scheduling Working on AWS Elastic Beanstalk Cron

We use AWS Elastic Beanstalk for quite a few projects and its’ rapid deployment models make it indispensable. Laravel 5 (5.1) includes a powerful Task Scheduling model that can be used to automate any part of your Laravel application using just one cron that runs an artisan command. If you’re setting environment variables directly through […]

Overload a Laravel Model’s __construct and save Methods

Here are a couple of quick snippets if you need the ability to overload a Model’s constructor or save methods.

Serve Javascript/CSS with a Laravel Route

For a quick solution to serving up a Javascript or CSS file using Laravel routes, i.e., take a look at the following snippet.