Laravel Tutorial Index

Configuration

The configuration of the Laravel application deals through the 'config' subdirectory, which holds the entire configuration file related to your Laravel project. This subdirectory keeps files like a database, mailing, services, and session-based configuration files with an extension of .config. The configuration of the Laravel project permits you to define configuration per environment. This tutorial will teach you about the different configurations and how the basic setup is done in Laravel.



Configuring the Basic in Laravel Project

If you are new to Laravel, you should know that you can create a configuration file for the Laravel application. After installing Laravel, you must perform the permission writing for your storage directory and the bootstrap/cache.

Next, you must generate the application key for session securing and encrypted data keys. In case the root directory doesn't have the .env file, you will have to rename the file .env.example to .env and run the command mentioned below where you've installed the Laravel:

php artisan key: generate

You can see in the .env file the newly generated key. In addition, it is possible to configure the locale time zone in your project's config/app.php file.

Configuring the Environment

Laravel allows us to run an application for diverse environments like testing, production, etc. You will need the .env file in the project's root directory to configure your application's environment. When you install the composer for Laravel, the composer automatically generates or creates this file. If you don't install it, rename the specific file with the name .env.example to .env only.

Configuring the Database

You can configure the database for your application using the config/database.php file of your project. Setting the configuration constraint utilized by various databases can also be done, and Laravel also allowed us to use the default one.

Maintenance Modes

Websites are regularly modified. As a developer, you must put your site in maintenance mode. In this advanced framework, it becomes easier to do that by using two artisan commands. Let's see how to use the commands:

For starting your project maintenance approach, the following command is required:

php artisan down

After changing the required stuff, when it is time to re-run your project, the following command is needed:

php artisan up


Found This Page Useful? Share It!
Get the Latest Tutorials and Updates
Join us on Telegram