Author Archives: Admin

What is Service provider in laravel?

Service provider will bootstrap all of the framework component such as database,queue,validation,routing components
All of the service providers are configured in the config/app.php provider array.
register() and boot() method will be called on all service providers,after this request will dispatch to route and controller
Default service providers are stored in the app/Providers folder

Click here for more interview questions

What is Kernel in laravel?

Click here for more interview questions
Two types of kernel available in laravel,

Http kernel- app/http/kernel.php
Console kernel- console/kernel.php

Kernel defines the list of midddleware and middleware will handle session,aunthentication,verifycsrftoken etc.
Kernel extends base class- Illuminate\Foundation\Http\Kernel it defines bootstrappers .Thesse bootstrapers configure error handling,logging,detecting application environment
Click here for more interview questions

What is Middleware in laravel?

Click here for more interview questions
Middleware acts as bridge between request and response.
Middleware verifies the user is authenticated or not depends on this it is redirect to home and login page.
command to create middleware
php artisan make:middleware

Two types of middleware in laravel

global middleware- run on every http request
routemiddleware-assigned to a specific route

middleware can be register inside app/kernel.php file as $routemiddleware[],$middleware[];
Click here for more interview questions

Maintenance mode in laravel

Click here for more interview questions
If the application in maintenance mode MaintenanceModeException exception will be throwing

use the below command to make application down

php artisan down

application down with message

php artisan down –message “some maintenance work gong on will be back soon” –retry=60

even in the maintenance mode some specific ip can access the application using the below command

php artisan down –allow=’192.168.0.22′ –allow=’127.3.56′

Disable the maintenance mode using php artisan up command
Click here for more interview questions

What is configuration caching

Click here for more interview questions
cache all configuration file into a single file, which load quickly by the framework

php artisan config:cache

normaly this will execute in the deployment,because local development configuration file frequntly changing.

once configuration cached env file will not be loaded it will be null
Click here for more interview questions

How to access the configuration values in laravel?

Click here for more interview questions
configuration values stored in the app.php

get the configuration value using the below code

$value = config(‘app.timezone’);

set the configuration value using the below code
To set configuration values at runtime, pass an array to the config helper:

config([‘app.timezone’ => ‘America/Chicago’]);

Click here for more interview questions