/var/log

Tag: Laravel

One Laravel codebase with multiple databases and hostnames

What we want to achieve: These are the steps needed to accomplish this. Symlink to codebase Each hostname should have be a symlink to the original codebase. For example our codebase is in /var/www/codebase and if we have a new hostname we should create a symlink to this codebase, for example a symlink /var/www/host1 pointing […]

Laravel and WordPress combined

WordPress and Laravel are popular frameworks that are good at what they are designed for. WordPress excels in managing content with revisions, taxonomies and a pretty good UI. Laravel is good in managing structured data with its eloquent models, routing and securing access to routes. Sometimes a project requires both the management of a lot […]

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';   } […]