- How can you generate URLs?
- List out common artisan commands used in Laravel
- In which folder robot.txt is placed?
- Why are migrations necessary?
- What is Eloquent?
- List available types of relationships in Laravel Eloquent.
- How will you register service providers?
- What is X-XSRF-TOKEN?
- What is benefits of using "Blade" Template in Laravel?
- What is Laravel Elixir?
- What are common HTTP error codes?
- What is Laravel API rate limit?
- How to get current environment in Laravel?
- Explain the concept of cookies.
- Define Lumen.
- Which file is used to create a connection with the database?
- In which directory controllers are kept in Laravel?
- What does ORM stand for?
- What is Laravel?
- What are the advantages of using Laravel?
- What is Laravel Forge?
- Explain Auth.
- Where will you define Laravel's Facades?
- Name databases supported by Laravel.
- How can you reduce memory usage in Laravel?
- How to use the custom table in Laravel Model?
- What are the difference between insert() and insertGetId() in laravel?
- How will you describe Fillable Attribute in a Laravel model?
- What is query scope?
- What is a raw expression in laravel?
- State the difference between authentication and authorization.
- Name some Inbuilt Authentication Controllers of Laravel.
- Explain active record concept in Laravel.
- In which language Laravel is written ?
- State the difference between get and post method.
- How can we check the logged-in user info in Laravel?
- What is the use of DB facade?
- How to check request is ajax or not ?
- Name the Template Engine utilized by Laravel.
- How can we check the Laravel current version?
- What is laravel spark?
- Explain Migrations in Laravel.
- Name aggregates methods of query builder.
- What is Monolog library in Laravel?
- What is a Controller?
- Explain the concept of contracts in Laravel.
- Which class is used to handle exceptions?
- Explain collections in Laravel.
- How can someone turn off CSRF protection for a specific route?
- How will you check table is exists or in the database?
- What is the use of dd() function?
- How can you access session data?
- Explain listeners.
- What is make method?
- What is Redis?
- Define hashing in Laravel.
- Explain reverse routing in Laravel.
- Why use Route?
- does Laravel support caching?
- Define @include.
- What is the deployer?
- What do you know about CSRF token in Laravel?
- Define Implicit Controller.
- Explain important directories used in a common Laravel application.
- How will you explain Guarded Attribute in a Laravel model?
- How to hash password in Laravel?
- What is a Route?
- What is HTTP middleware?
- How to Install Laravel via Composer?
- How to Install Lumen via Composer?
- How to clear Cache in Laravel?
- What is a fluent query builder in Laravel?
- What are policies classes?
- Explain the concept of events in Laravel.
- What is Route Model Binding?
- Explain Laravel echo.
- How to compare two Carbon Timestamps?
- Explain homestead in the Laravel.
- Explain Laravel’s Middleware.
- What is service container in Laravel?
- How can you make real time sitemap.xml file in Laravel?
- What is MVC framework?
- Explain traits in Laravel.
- What are the disadvantages of using Laravel?
- Explain dependency injection and their types.
- What is namespace in Laravel?
- How to remove a complied class file?
- What do you mean by Laravel Dusk?
- What is Lazy vs Eager Loading in Laravel?
- How to rollback last migration?
- Explain PHP artisan.
- List some default packages provided by Laravel 5.4 ?
- What is Singleton design pattern?
- What do you mean by bundles?
- What is Laravel Envoyer?
- What is a session in Laravel?
- How to configure a mail-in Laravel?
- Explain faker in Laravel.
- How can you enable query log in Laravel?
- What is the use of the bootstrap directory?
- How to create middleware in Laravel?
- What is Closure in Laravel?
- What is Ajax in Laravel?
- Explain Response in Laravel.
- Differentiate between delete() and softDeletes().
- Define composer.
- Which of following Collection method returns all records from Laravel collection?
- View files in Laravel end in
- Which one is the Laravel command line interface?
- Which artisan command is used to remove the compiled class file?
- Which directory contain “robot.txt” file ?
- What is Blade?
- What is @yield used for?
- Which command is used to start laravel server?
- Laravel is based on _____________________.
- . Which of following methods are used in database migrations classes?
- The vendor directory contains
- Artisan command to flush the application cache:
Laravel has helpers to generate URLs. This is helpful when you build link in your templates and API response.
- PHP artisan down;
- PHP artisan up;
- PHP artisan make:controller;
- PHP artisan make:model;
- PHP artisan make:migration;
- PHP artisan make:middleware;
Robot.txt file is placed in Public directory.
Migrations are necessary because:
- Without migrations, database consistency when sharing an app is almost impossible, especially as more and more people collaborate on the web app.
- Your production database needs to be synced as well.
Eloquent is an ORM used in Laravel. It provides simple active record implementation working with the database. Each database table has its Model, which used to interact with the table.
Types of relationship in Laravel Eloquent are:
- One To One
- One To Many
- Many To Many
- Has Many Through, and
- Polymorphic Relations.
You can register service providers in the config/app.php configuration file that contains an array where you can mention the service provider class name.
Laravel stores the current CSRF token in a XSRF-TOKEN cookie that is included with each response generated by the framework. You can use the cookie value to set the X-XSRF-TOKEN request header.
Unlike other popular PHP templating engines, Blade does not restrict you from using plain PHP code in your views. In fact, all Blade views are compiled into plain PHP code and cached until they are modified, meaning Blade adds essentially zero overhead to your application. Blade view files use the .blade.php file extension and are typically stored in the resources/views directory.
- Error 404 – Displays when Page is not found.
- Error- 401 – Displays when an error is not authorized
It is a feature of Laravel. It provides handle throttling. Rate limiting helps Laravel developers to develop a secure application and prevent DOS attacks.
$environment = App::environment();
Cookies are small file sent from a particular website and stored on PC by user's browser while the user is browsing.
Lumen is a micro-framework. It is a smaller, and faster, version of a building Laravel based services, and REST API's.
To create a connection with the database, you can use .env file.
Controllers are kept in app/http/Controllers directory.
ORM stands for Object Relational Mapping
Laravel is an open-source widely used PHP framework. The platform was intended for the development of web application by using MVC architectural pattern. Laravel is released under the MIT license. Therefore, its source code is hosted on GitHub. It is a reliable PHP framework as it follows expressive and accurate language rules.
- Laravel has blade template engine to create dynamic layouts and increase compiling tasks.
- Reuse code without any hassle.
- Laravel provides you to enforce constraints between multiple DBM objects by using an advanced query builder mechanism.
- The framework has an auto-loading feature, so you don't do manual maintenance and inclusion paths
- The framework helps you to make new tools by using LOC container.
- Laravel offers a version control system that helps with simplified management of migrations.
Laravel Forge is a tool that helps in organising and designing a web application. Although the manufacturers of the Laravel framework developed it, it can automate the deployment of every web application that works on a PHP server.
It is a method of identifying user login credential with a password. In Laravel it can be managed with a session which takes two parameters:
All facades of Laravel are defined in Illuminate\Support\Facades namespace.
- SQL Server
While processing a large amount of data, you can use the cursor method in order to reduce memory usage.
In order to use a custom table, you can override the property of the protected variable $table.
- insertGetId(): This method is also used for insert records into the database table. This method is used in the case when an id field of the table is auto-incrementing.
It returns the id of current inserted records.
- Inserts(): This method is used for insert records into the database table. No need the "id" should be autoincremented or not in the table.
In eloquent ORM, $fillable attribute is an array containing all those fields of table which can be filled using mass-assignment.
Mass assignment refers to sending an array to the model to directly create a new record in Database.
It is a feature of Laravel where we can reuse similar queries. We do not require to write the same types of queries again in the Laravel project. Once the scope is defined, just call the scope method when querying the model.
Raw Expressions allow you to tell the query builder that you want to use what you entered and not get processed or manipulate before running the query against the database.
Authentication means confirming user identities through credentials, while authorization refers to gathering access to the system.
In active record, class map to your database table. It helps you to deal with CRUD operation.
Laravel is written in PHP.
Get method allows you to send a limited amount of data in the header. Post allows you to send a large amount of data in the body.
User() function is used to get the logged-in user
DB facade is used to run SQL queries like create, select, update, insert, and delete.
In Laravel, we can use $request->ajax() method to check request is ajax or not.
Blade is a powerful template engine utilized by Laravel.
One can easily check the current version of Laravel installation using the -version option of artisan command.
Spark is a Laravel package that provides scaffolding for all of the stuff you don't want to code.
Laravel Migrations are like version control for the database, allowing a team to easily modify and share the application’s database schema. Migrations are typically paired with Laravel’s schema builder to easily build the application’s database schema.
Aggregates methods of query builder are:
Laravel utilizes the Monolog library, which provides support for a variety of powerful log handlers.
A controller is the "C" in the "MVC" (Model-View-Controller) architecture, which is what Laravel is based on.
They are set of interfaces of Laravel framework. These contracts provide core services. Contracts defined in Laravel include corresponding implementation of framework.
Laravel exceptions are handled by App\Exceptions\Handler class.
Collections is a wrapper class to work with arrays.
To turn off CSRF protection for a specific route, we can add that specific URL or Route in $except variable which is present in the app\Http\Middleware\VerifyCsrfToken.phpfile.
Use hasTable() Laravel function to check the desired table is exists in the database or not.
This function is used to dump contents of a variable to the browser. The full form of dd is Dump and Die.
Session data be access by creating an instance of the session in HTTP request. Once you get the instance, use get() method with a "Key" as a parameter to get the session details.
Listeners are used to handling events and exceptions. The most common listener in Laravel for login event is LoginListener.
Laravel developers can use make method to bind an interface to concreate class. This method returns an instance of the class or interface. Laravel automatically inject dependencies defined in class constructor.
Redis is an open source, advanced key-value store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets, and sorted sets.
It is the method of converting text into a key that shows the original text. Laravel uses the Hash facade to store the password securely in a hashed manner.
Reverse routing is a method of generating URL based on symbol or name. It makes your Laravel application flexible.
Routes are stored inside files under the /routes folder inside the project's root directory. By default, there are a few different files corresponding to the different "sides" of the application ("sides" comes from the hexagonal architecture methodology).
Yes, Laravel supports popular caching backends like Memcached and Redis. By default, Laravel is configured to use the file cache driver, which stores the serialized, cached objects in the file system.For large projects, it is recommended to use Memcached or Redis.
@include is used to load more than one template view files. It helps you to include view within another view. User can also load multiple files in one view.
Deployer provides a turn-key Kubernetes-based application management platform that accelerates the adoption of open-source and cloud-native technologies.
CSRF protection stands for Cross-Site Request Forgery protection. CSRF detects unauthorized attacks on web applications by the unauthorized users of a system. The built-in CSRF plug-in is used to create CSRF tokens so that it can verify all the operations and requests sent by an active authenticated user.
Implicit Controllers help you to define a proper route to handle controller action. You can define them in route.php file with Route:: controller() method.
Directories used in a common Laravel application are:
- App/: This is a source folder where our application code lives. All controllers, policies, and models are inside this folder.
- Config/: Holds the app's configuration files. These are usually not modified directly but instead, rely on the values set up in the .env (environment) file at the root of the app.
- Database/: Houses the database files, including migrations, seeds, and test factories.
- Public/: Publicly accessible folder holding compiled assets and of course an index.php file.
The guarded attribute is the opposite of fillable attributes.
In Laravel, fillable attributes are used to specify those fields which are to be mass assigned. Guarded attributes are used to specify those fields which are not mass assignable.
The Hash::make function is used to create a hash for the password.
A route is basically an endpoint specified by a URI (Uniform Resource Identifier). It acts as a pointer in Laravel application.
Most commonly, a route simply points to a method on a controller and also dictates which HTTP methods are able to hit that URI.
HTTP middleware is a technique for filtering HTTP requests. Laravel includes a middleware that checks whether application user is authenticated or not.
composer create-project --prefer-dist laravel/laravel myproject
composer create-project --prefer-dist laravel/lumen myproject
You can use php artisan cache:clear commnad to clear Cache in Laravel.
The Fluent Query Builder is Laravel's powerful fluent interface for building SQL queries and working with your database.
Policies classes include authorization logic of Laravel application. These classes are used for a particular model or resource.
An event is an occurrence or action that help you to subscribe and listen for events that occur in Laravel application. Some of the events are fired automatically by Laravel when any activity occurs.
When injecting a model ID to a route or controller action, you will often query to retrieve the model that corresponds to that ID. Laravel route model binding provides a convenient way to automatically inject the model instances directly into your routes.
First, Eloquent automatically converts its timestamps ( created_at, updated_at ) into carbon objects. You could just use updated_at to get that nice feature, or specify edited_at in your model in the $dates property: protected $dates = ['edited_at'];
Homestead is basically an official, pre-packaged, and vagrant virtual machine that is used to deliver Laravel developers and all the necessary tools in order to develop Laravel out of the box. This machine is also known to include Ubuntu, Gulp, Bower, and various other development tools that are useful in developing full-scale web applications.
As the name suggests, Middleware acts as a middleman between request and response. It is a type of filtering mechanism. There are two types of Middleware in Laravel.
- Global Middleware: will run on every HTTP request of the application.
- Route Middleware: will be assigned to a specific route.
Service container is a tool used for performing dependency injection in Laravel.
You can create all web pages of a website to tell the search engine about the organizing site content. The crawlers of search engine read this file intelligently to crawl a website.
It is Model, View, and Controller:
- Model: Model defines logic to write Laravel application.
- View: It covers the UI logic of Laravel application.
- Controller: It works as an interface between Model, and View. It is a way how the user interacts with an application.
Laravel traits are a group of functions that you include within another class. A trait is like an abstract class. You cannot instantiate directly, but its methods can be used in concreate class.
- Development process requires you to work with standards and should have real understanding of programming
- Laravel is new framework and composer is not so strong in compare to npm (for node.js), ruby gems and python pip.
- Development in laravel is not so fast in compare to ruby on rails.
- Laravel is lightweight so it has less inbuilt support in compare to django and rails. But this problem can be solved by integrating third party tools, but for large and very custom websites it may be a tedious task-
It is a technique in which one object is dependent on another object. There are three types of dependency injection:
- Constructor injection
- Setter injection
- Interface injection.
A namespace allows a user to group the functions, classes, and constants under a specific name.
Use clear-compiled command to remove the compiled class file.
Laravel Eloquent ORM provides two type of loading.
- Lazy Loading: By default, accessing data in eloquent is "Lazy loaded"
- Eager Loading: This can be achieved using with() in Eloquent. Eager loading alleviates the N + 1 query problem.
Use need to use artisan command to rollback the last migration.
An artisan is a command-line tool of Laravel. It provides commands that help you to build Laravel application without any hassle.
Singleton design pattern is a creational pattern that is used whenever only one instance an object is needed to be created. In this pattern, you can't initialize the class.
In Laravel, bundles are referred to as packages. These packages are used to increase the functionality of Laravel. A package can have views, configuration, migrations, routes, and tasks.
Envoyer is a zero-down-time deployer for PHP & Laravel projects, which means it is a tool that you connect to your server to run your deploys, and which uses a series of tools to ensure that all of the preparation work each deploy needs in order to run.
Session is used to pass user information from one web page to another. Laravel provides various drivers like a cookie, array, file, Memcached, and Redis to handle session data.
Laravel provides APIs to send an email on local and live server.
It is a type of module or packages which are used to create fake data. This data can be used for testing purpose.
It is can also be used to generate:
- Lorem text
You can use enableQueryLog method to enable query log in Laravel.
It is used to initialize a Laravel project. This bootstrap directory contains app.php file that is responsible for bootstrapping the framework.
php artisan make: middleware
A Closure is an anonymous function. Closures are often used as callback methods and can be used as a parameter in a function.
All controllers and routes should return a response to be sent back to the web browser. Laravel provides various ways to return this response. The most basic response is returning a string from controller or route.
- delete(): remove all record from the database table.
- softDeletes(): It does not remove the data from the table. It is used to flag any record as deleted.
It is an application-level package manager for PHP. It provides a standard format for managing PHP software dependencies and libraries.
- A) ->all()
- B) ->get()
- C) ->where()
- D) ->whereAll()
- A) .blade.php
- B) .php
- C) .vue
- D) .blade
- A) CLI
- B) php artisan
- C) composer
- D) git
- A) clearcompiled
- B) clear compiled
- C) clear-compiled
- D) clear:all
- A) app
- B) public
- C) config
- D) storage
- A) Template Engine
- B) package
- C) view file
- D) framework
- A) to display the contents of a given section.
- B) to extend an layout
- C) to include a file
- A) php artisan serve
- B) php artisan start
- C) php artisan start-server
- D) php artisan project_name
- A) MVVM Design Pattern
- B) MVC Design Pattern
- C) Singleton Design Pattern
- D) Composite Design Pattern
- A) execute() and rollback()
- B) up() and down()
- C) run() and delete()
- D) save() and update()
- A) Laravel Framework code
- B) Assets
- C) Third-party code
- D) Configuration files
- A) cache:flush
- B) cache:clear
- C) cache:forget
- D) cache:remove
Want to test this skill? Checkout Adaface assessments
PHP & Laravel
PHP, Laravel & SQL
Laravel Online Test
PHP & Magento
(100% free to get started, no credit card required)