Laravel: Accessing Configuration Values

All of the configuration files for the Laravel framework are stored in the config directory with each configuration option properly documented. Accessing Configuration Values You can access your configuration values using the global config(‘‘, ‘‘) helper function from anywhere in your application. For Example: You can access configurations from config/app.php configuration file like below:

NOTE: After making… Read More »

Laravel: Environment configurations

Each application generally have following environments: Development Staging/Testing/UAT Production Since we have different application environments, so we may have different configurations/settings for each environment. If you install Laravel via Composer, you will find a file named .env. This environment file contains environment specific settings. So, it should be noted that your .env file should not be committed to your… Read More »

Laravel: Log Viewer

To view logs for debugging is helpful to fix issues. In Laravel, by default a single log file is generated named storage/logs/laravel.log. You can configure this to have single log file on daily basis in order to avoid a single large log file by updating ‘LOG_CHANNEL‘ environment variable value to ‘daily‘(Check .env file or configuration… Read More »

Laravel: User and Admin authentication using different tables

There are many applications where we can not treat administrators in the table where users are because users have many different properties associated with them as well as different functionalities as compared to administrators. The main key point that needs to be managed here to complete this task is have new authentication guard and user… Read More »

Laravel: Create custom helper

Laravel Custom Helper Create a folder named Helpers within app directory. Create a helper named app/Helpers/AppHelper.php

Now, register AppHelper class alias in config/app.php

That’s it. Now you can access this helper function anywhere (controller, view, etc.) in the application like below:


Laravel: Override default registration functionality

Laravel provides some already built-in features like authentication(login) and registration that makes this framework awesome. But, sometimes we don’t want to use the default functionality or behavior provided by Laravel. Laravel default registration feature has very generic fields. But, any application’s registration requires many other fields with different type of validations. Lets consider we have fields first_name… Read More »

Laravel: Configure database – MySQL

Laravel supports four databases: MySQL PostgreSQL SQLite SQL Server  Configuration The database configuration file of the application is located at config/database.php. In this file you may define all of your database connections along with the default connection. Here, we are considering MySQL database connection.

Here, we can see that some environment variables e.g. DB_DATABASE. You can… Read More »

Laravel: Installation of Laravel using composer and Configuration

Steps to Installation of Laravel(Considering Laravel 5.6 version) Server Requirements The Laravel framework has a few system requirements. So, you will need to make sure your server meets the following requirements: PHP >= 7.1.3 OpenSSL PHP Extension PDO PHP Extension Mbstring PHP Extension Tokenizer PHP Extension XML PHP Extension Ctype PHP Extension JSON PHP Extension… Read More »