Thursday 26 April 2018

Laravel Interview Questions

Question1. Does Laravel Support Caching?

Answer : Yes, Its provides.

Question2. How To Use Delete Statement In Laravel?

Answer : DB::delete('delete from  users where id = ?', [1015]);

Question3. How To Use Update Statement In Laravel?

Answer : DB::update('update users set city_id = 10 where id = ?', [1015]);

Question4. How To Use Insert Statement In Laravel?

Answer : DB::insert('insert into users (id, name, city_id) values (?, ?)', [1, 'Web technology',10]);

Question5. How To Use Select Query In Laravel?

Answer :
$users = DB::select('select * from users where city_id = ?', 10);
if(!empty($users)){
   foreach($users as $user){
   }
}

Question6. How To Enable The Query Logging?

Answer :
DB::connection()->enableQueryLog();

Question7. How To Set Database Connection In Laravel?

Answer : 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'    => '',
],

Question8. What Are Bundles,reverse Routing And The Ioc Container ?

Answer :
    • 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.

Question9. Compare Laravel With Codeigniter?

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

Question10. What Are The Feature Of Laravel 5.0?

Answer :
    • Method injection
    • Contracts
    • Route caching
    • Events object
    • Multiple file system
    • Authentication Scaffolding
    • dotenv – Environment Detection
    • Laravel Scheduler

Question11. Explain About Laravel Project?

Answer :
    • 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.

Question12. What Are Advantages Of Laravel?

Answer :
    • Easy and consistent syntax
    • Set-up process is easy
    • customization process is easy
    • code is always regimented with Laravel

Question13. What Is Laravel?

Answer :
    • 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.

Question14. What Is System Requirement For Installation Of Laravel 5.2 (latest Version)?

Answer :
    • PHP >= 5.5.9
    • OpenSSL PHP Extension
    • PDO PHP Extension
    • Mbstring PHP Extension
    • Tokenizer PHP Extension

Question15. How To Install Laravel?

Answer : We can install the Laravel in following ways.

    • Laravel Installer
    • Composer Create-Project

More about Laravel:

1 comment: