Laravel and SELinux

When SELinux is enabled, apache can be denied to write to the storage directory even if the permission of this directory is set to 777. chcon -Rt httpd_sys_content_rw_t storage/ You can see the result: ls -Z

Laravel and SVN

Laravel assumes you’re using GIT to handle version control. Here is a guideline to fix it for SVN. In short: just add all the files and directories named  in the .gitignore files to the SVN ignore list. Add the contents of the following directories to the ignore list (so the directories will be in version […]

Remove web middleware for API in Laravel

The web middleware is by default loaded for ebery route in the app/Http/routes.php file. If you create an API, you mostly don’t need all the things this web middleware is loading, like cookie sessions and CRSF protection. To create routes for the API: Create a new app/Http/routes-api.php file and add the routes for the API. […]

Laravel dynamically detect environment

Laravel 5.2 comes with a .env file and tells you to not check it in. The idea behind it, is that you will have another .env file on your development, testing and production server. But if you want to dynamically detect and set your environment, this does not work too well. To make dynamically detection and […]

Laravel change paths

Change storage path To change the storage path in Laravel (tested with version 5.2 and 5.3) you have to extend the Application class and then override the storagePath() method. You can do this all in the bootstrap/app.php file: class MyApplication extends \Illuminate\Foundation\Application {   public function storagePath() {     return $this->basePath . ‘/../storage’;   } […]