Posted in Laravel

Securely setting file permissions for Laravel Framework

After developing the application locally, when the application is moved to production, people find that web page fails to display the content. This may be due to proper file permissions. Some simply gives complete read, write and execute permission for files and directories like this:

sudo chmod -R 777 path/to/root

which is a serious security concern. Follow these steps to securely grant permissions to your files:

Continue reading “Securely setting file permissions for Laravel Framework”

Posted in Laravel

Add multiple contents to @yield from @section

Sometimes, we may extend/include more than one template inside a layout. When we need to define a section of content in a single yield, it perfectly does its job. But when there is a situation that needs to include multiple sections inside a single yield, the first section is overridden by the next section resulting in displaying only the last section in the yield directive.

Continue reading “Add multiple contents to @yield from @section”

Posted in Laravel

Change order of migration in Laravel

When tables are migrated in Laravel with foreign key checks, MySQL doesn’t allow us to create a foreign key reference to the parent table from the child table without parent table being created. Sometimes, when we create migrations, we would have ended up creating a child table before a parent table is created. But still, there is a way to change the order of execution of table migrations.

Continue reading “Change order of migration in Laravel”