Skip to main content

Laravel Interview Questions and Answers

Question: What is Laravel?
Laravel is a open-source PHP framework developed by Taylor Otwell used for Developing the websites. 
Laravel helps you create applications using simple, expressive syntax. 


Question: What are Advantages of Laravel?
  1. Easy and consistent syntax
  2. Set-up process is easy
  3. customization process is easy
  4. code is always regimented with Laravel



Question: Explain about Laravel Project?
Laravel is one of the most popular PHP frameworks used for Web Development.
This framework is with expressive, elegant syntax. 
It is based on model–view–controller (MVC) architectural pattern. 


Question: What are the feature of Laravel5.0?
  1. Method injection
  2. Contracts
  3. Route caching
  4. Events object
  5. Multiple file system
  6. Authentication Scaffolding
  7. dotenv – Environmental Detection
  8. Laravel Scheduler



Question: Compare Laravel with Codeigniter?
LaravelCodeigniter
Laravel is a framework with expressive, elegant syntaxCodeIgniter is a powerful PHP framework
Development is enjoyable, creative experienceSimple and elegant toolkit to create full-featured web applications.
Laravel is built for latest version of PHPCodeigniter is an older more mature framework
It is more object oriented compared to CodeIgniter.It is less object oriented compared to Laravel.
Laravel community is still small, but it is growing very fast.Codeigniter community is large.



Question: What are Bundles,Reverse Routing and The IoC container ?
Bundles: These are small functionality which you may download to add to your web application.
Reverse Routing: This allows you to change your routes and application will update all of the relevant links as per this link.
IoC container: It gives you Control gives you a method for generating new objects and optionally instantiating and referencing singletons.



Question: How to set Database connection in Laravel?
Database configuration file path is : config/database.php
Following are sample of database file 
 
'mysql' => [
    'read' => [
        'host' => 'localhost',
    ],
    'write' => [
        'host' => 'localhost'
    ],
    'driver'    => 'mysql',
    'database'  => 'database',
    'username'  => 'root',
    'password'  => '',
    'charset'   => 'utf8',
    'collation' => 'utf8_unicode_ci',
    'prefix'    => '',
],
 



Question: How to enable the Query Logging?
DB::connection()->enableQueryLog();



Question: How to use select query in Laravel?
$users = DB::select('select * from users where city_id = ?', 10);
if(!empty($users)){
    foreach($users as $user){

    }
} 



Question: How to use Insert Statement in Laravel?
DB::insert('insert into users (id, name, city_id) values (?, ?)', [1, 'Web technology',10]);



Question: How to use Update Statement in Laravel?
DB::update('update users set city_id = 10 where id = ?', [1015]);



Question: How to use Update Statement in Laravel?
DB::update('update users set city_id = 10 where id = ?', [1015]);



Question: How to use delete Statement in Laravel?
DB::delete('delete from  users where id = ?', [1015]);



Question: Does Laravel support caching?
Yes, Its provides.

Comments

Popular posts from this blog

JazzCash Mobile Account

  JazzCash Mobile Account Help Center  > JazzCash Mobile Account What is JazzCash mobile account? JazzCash Mobile Account is an actual bank account that is tagged with your mobile number and can be operated through your phone. Through this Mobile Account you can enjoy complete freedom of accessing financial services anywhere, anytime! More importantly, you don’t have to rely on traveling to a Bank branch, wait at queues or complete any documentation. Mobile Account menu works on all types of mobile phones – smart phone is not required. Customers can make deposits or withdrawals through any Mobilink Microfinance Bank Branch, Mobilink Franchise, Mobilink Business Center and Jazzcash Agents spread across Pakistan. JazzCash Mobile App In line with the continuous digitization of its services to meet demands of growing number of smartphone users, JazzCash is proud to announce Android based App for its Mobile Account users. The App offers a user friendly inte...

Difference Between Primary Key and Unique Key In Sql Server

Both  PRIMARY KEY  and  UNIQUE KEY  enforces the Uniqueness of the values  (i.e. avoids duplicate values) on the column[s] on which it is defined.  Also these key’s can Uniquely identify each row in database table. Below table lists out the major  difference between PRIMARY KEY and UNIQUE KEY : PRIMARY KEY UNIQUE KEY NULL It doesn’t allow Null values. Because of this we refer PRIMARY KEY = UNIQUE KEY + Not Null CONSTRAINT Allows Null value. But only one Null value. INDEX By default it adds a clustered index By default it adds a UNIQUE non-clustered index LIMIT A table can have only one PRIMARY KEY Column[s] A table can have more than one UNIQUE Key Column[s] CREATE SYNTAX Below is the sample example for defining a single column as a PRIMARY KEY column while creating a table: CREATE TABLE  dbo.Customer ( Id  IN...

Remove the Loadblanks.ru Browser Hijacker (Removal Guide)

What is Loadblanks.ru Browser Hijacker? Skip this and learn how to remove Loadblanks.ru Browser Hijacker! The  Loadblanks.ru Browser Hijacker  is a computer infection from the  Adware/ShortcutHijacker  family that changes the shortcuts for your installed web browsers so that they automatically open the loadblanks.ru web page. It does this by pointing the browser shortcuts to batch files located in the  %UserProfile%\AppData\Roaming\Browsers\  folder as shown below. These batch files contain an obfuscated command that opens the specified browser to a specific page. In this case, the browser will be forced to automatically open the http://ic.loadblanks.ru/ or http://im.loadblanks.ru homepages. An example of the command executed by the batch file is  start "" "c:\PROGRA~2\google\chrome\APPLIC~1\chrome.exe" "http://im.loadblanks.ru/c/b26cdff542ee7ff6?" . You can see an example of this obfuscated batch file below. Due to these modified sho...