Laravel
List some features of laravel 5.0 ?
-Inbuilt CRSF (cross-site request forgery ) Protection. Reverse Routing Route caching Database Migration service container.
Explain Events in laravel ?
An event is an action or occurrence recognized by a program that may be handled by the program or code. Laravel events provides a simple observer implementation, that allowing you to subscribe and listen for various events/actions that occur in your application. All Event classes are generally stored in the app/Events directory, while their listeners are stored in app/Listeners of your application.
Explain Laravel's Middleware?
As the name suggests, Middleware acts as a middleman between request and response. It is a type of filtering mechanism. For example, Laravel includes a middleware that verifies whether the user of the application is authenticated or not. If the user is authenticated, he will be redirected to the home page otherwise, he will be redirected to the login page. 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.
What are laravel guards?
At its core, Laravel's authentication facilities are made up of "guards" and "providers". Guards define how users are authenticated for each request. For example, Laravel ships with a session guard which maintains state using session storage and cookies.
List some default packages provided by Laravel 5.6 ?
Cashier Envoy Passport Scout Socialite Horizon
what are some things laravel comes built with?
Comes with inbuilt features/ modules like authentication, authorization, localization, models, views, sessions, paginations and routing
What is composer ?
Composer is a tool for managing dependency in PHP. It allows you to declare the libraries on which your project depends on and will manage (install/update) them for you. Laravel utilizes Composer to manage its dependencies.
what advanced concepts of PHP and OOPs does laravel support?
Dependency Injection, traits, Contracts, bundles, Namespaces, Facades
What is envoyer, and forge. What are the differences?
Deployment tools.... typically use Forge to provision and manage my servers, then pair those servers with Envoyer to achieve zero-downtime deployments Envoyer: fine grained control over deployment for multiple environments. The biggest selling point is zero downtime deployments, but Envoyer also provides you with things like health checks and notifications to give you piece of mind that your deployments went well. Forge: basic deploy but mainly configure your server. add sub-domains, install SSL certificates, create queue workers, create Cron jobs,
Explain Bundles in Laravel?
In Laravel, bundles are also called packages.Packages are the primary way to extend the functionality of Laravel. Packages might be anything from a great way to work with dates like Carbon, or an entire BDD testing framework like Behat
Explain validations in laravel?
In Programming validations are a handy way to ensure that your data is always in a clean and expected format before it gets into your database. Laravel provides several different ways to validate your application incoming data.By default Laravel's base controller class uses a ValidatesRequests trait which provides a convenient method to validate all incoming HTTP requests coming from client.You can also validate data in laravel by creating Form Request. click here (https://laravel.com/docs/5.4/validation) read more about data validations in Laravel.
What is dependency injection in Laravel ?
In software engineering, dependency injection is a technique whereby one object supplies the dependencies of another object. A dependency is an object that can be used (a service). An injection is the passing of a dependency to a dependent object (a client) that would use it. The service is made part of the client's state.[1] Passing the service to the client, rather than allowing a client to build or find the service, is the fundamental requirement of the pattern. https://en.wikipedia.org/wiki/Dependency_injection You can do dependency injection via Constructor, setter and property injection.
what is horizon
Laravel Horizon is a queue manager that gives you full control over your queues, it provides means to configure how your jobs are processed, generate analytics, and perform different queue-related tasks from within a nice dashboard. such as emails and notifications.
what is nova
Laravel Nova is a beautiful admin dashboard for Laravel applications. Of course, the primary feature of Nova is the ability to administer your underlying database records using Eloquent. Nova accomplishes this by allowing you to define a Nova "resource" that corresponds to each Eloquent model in your application.
what is scout
Laravel Scout provides a simple, driver based solution for adding full-text search to your Eloquent models. Using model observers, Scout will automatically keep your search indexes in sync with your Eloquent records. Currently, Scout ships with an Algolia driver; however, writing custom drivers is simple and you are free to extend Scout with your own search implementations.
what is telescope
Laravel Telescope is an elegant debug assistant for the Laravel framework. Telescope provides insight into the requests coming into your application, exceptions, log entries, database queries, queued jobs, mail, notifications, cache operations, scheduled tasks, variable dumps and more.
What is Laravel?
Laravel is free open source "PHP framework" based on MVC design pattern. It is created by Taylor Otwell. Laravel provides a lot of syntaxic sugar
What is reverse routing in Laravel?
Laravel reverse routing is generating URL's based on route declarations. Reverse routing makes your application so much more flexible. It defines a relationship between links and Laravel routes. When a link is created by using names of existing routes, appropriate Uri's are created automatically by Laravel. Here is an example of reverse routing. // route declaration Route::get('login', 'users@login'); Using reverse routing we can create a link to it and pass in any parameters that we have defined. Optional parameters, if not supplied, are removed from the generated link. {{ HTML::link_to_action('users@login') }} It will automatically generate an Url like http://xyz.com/login in view.
What is Laravel's eloquent?
Laravel's Eloquent ORM (Object-relational mapping) is simple Active Record implementation for working with your database. Laravel provide many different ways to interact with your database, Eloquent is most notable of them. Each database table has a corresponding "Model" which is used to interact with that table. Models allow you to query for data in your tables, as well as insert new records into the table. // Querying or finding records from products table where tag is 'new' $products= Product::where('tag','new'); // Inserting new record $product =new Product; $product->title="Iphone 7"; $product->price="$700"; $product->tag='iphone'; $product->save();
What is Lumen?
Lumen is PHP micro-framework that built on Laravel's top components.It is created by Taylor Otwell. It is perfect option for building Laravel based micro-services and fast REST API's. It's one of the fastest micro-frameworks available. You can install Lumen using composer by running below command composer create-project --prefer-dist laravel/lumen blog
What is database migration. How to create migration via artisan ?
Migrations are like version control for your database, that's allow your team to easily modify and share the application's database schema. Migrations are typically paired with Laravel's schema builder to easily build your application's database schema. php artisan make:migration create_users_table
what types of DB's does it support?
MySQL, PostgreSQL, SQLite, SQL Server.
What are named routes in Laravel?
Named routing is another amazing feature of Laravel framework. Named routes allow referring to routes when generating redirects or Urls more comfortably. You can specify named routes by chaining the name method onto the route definition: Route::get('user/profile', function () { // })->name('profile'); You can specify route names for controller actions: Route::get('user/profile', 'UserController@showProfile')->name('profile'); Once you have assigned a name to your routes, you may use the route's name when generating URLs or redirects via the global route function: // Generating URLs... $url = route('profile'); // Generating Redirects... return redirect()->route('profile');
List types of relationships available in Laravel Eloquent?
One To One One To Many One To Many (Inverse) Many To Many Has Many Through Polymorphic Relations Many To Many Polymorphic Relations
Explain Laravel's service container ?
One of the most powerful feature of Laravel is its Service Container. It is a powerful tool for resolving class dependencies and performing dependency injection in Laravel. Dependency injection is a fancy phrase that essentially means class dependencies are "injected" into the class via the constructor or, in some cases, "setter" methods.
What are traits in Laravel?
PHP Traits are simply a group of methods that you want include within another class. .Trait are created to reduce the limitations of single inheritance in PHP by enabling a developer to reuse sets of methods freely in several independent classes living in different class hierarchies.
What is PHP artisan. List out some artisan commands ?
PHP artisan is the command line interface/tool included with Laravel. It provides a number of helpful commands that can help you while you build your application easily. Here are the list of some artisan command:- php artisan list php artisan help php artisan tinker php artisan make php artisan -versian php artisan make model model_name php artisan make controller controller_name
What are service providers ?
Service Providers are central place where all laravel application is bootstrapped . Your application as well all Laravel core services are also bootstrapped by service providers. But, what do we mean by "bootstrapped"? In general, we mean registering things, including registering service container bindings, event listeners, middleware, and even routes. Service providers are the central place to configure your application. If you open the config/app.php file included with Laravel, you will see a providers array. These are all of the service provider classes that will be loaded for your application. Of course, many of these are "deferred" providers, meaning they will not be loaded on every request, but only when the services they provide are actually needed.
What is difference between laravel find and where?
The where() methods gets translated to a WHERE of the underlying RDBMS (like MySQL, Postgres) and you use this to find records by one or more constraints (color, size). It returns always a Builder instance. The find() method is a special where, which used to find a record by its primary ID. It returns an instance of the Eloquent model or a collection (in case you passing multiple IDs to the method) or null (in case no result was found).
How to enable query log in Laravel ?
Use the enableQueryLog method to enable query log in Laravel DB::connection()->enableQueryLog(); You can get array of the executed queries by using getQueryLog method: $queries = DB::getQueryLog();
Pros of using Laravel Framework -lightweight blade template engine -Eloquent ORM -command line tool "Artisan" for creating a code skeleton , database structure and build their migration Cons of using laravel Framework: 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
What are pros and cons of using Laravel Framework?
Why are migrations necessary?
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.
Does Laravel support caching?
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.
How to use custom table in Laravel Modal ?
You can use custom table in Laravel by overriding protected $table property of Eloquent. Below is sample uses class User extends Eloquent{ protected $table="my_user_table"; }
What are Laravel Contract's ?
a set of interfaces that define the core services provided by the Laravel framework. https://laravel.com/docs/5.6/contracts
How to install laravel via composer ?
composer create-project laravel/laravel your-project-name version
List some Aggregates methods provided by query builder in Laravel ?
count() max() min() avg() sum()
How to turn off CRSF protection for specific route in Laravel?
edit code in "app/Http/Middleware/VerifyCsrfToken.php"
what templating engine does it use?
filename.blade.php
what is algolia
searchable response from db querires. Laravel Scout provides a simple, driver based solution for adding full-text search to your Eloquent models. Using model observers, Scout will automatically keep your search indexes in sync with your Eloquent records. Currently, Scout ships with an Algolia driver; however, writing custom drivers is simple and you are free to extend Scout with your own search implementations.
What is Singleton design pattern?
single instance of a class, ie: database connection or configuration manager.
Explain Facades in Laravel ?
syntatic sugar to call app/services in the services container. Laravel Facades provides a static like an interface to classes that are available in the application's service container. Laravel self-ships with many facades which provide access to almost all features of Laravel 's. Laravel facades serve as "static proxies" to underlying classes in the service container and provide benefits of a terse, expressive syntax while maintaining more testability and flexibility than traditional static methods of classes. All of Laravel's facades are defined in the Illuminate\Support\Facades namespace. You can easily access a facade like so: use Illuminate\Support\Facades\Cache; Route::get('/cache', function () { return Cache::get('key'); });
How to hash password in laravel
use the Hash facade.
What is socialite laravel?
when signing up, users have the option of signing up with a social provider such as Facebook, Github and Twitter signups
How to use where relationship Laravel
where like sql. where email like '%gh%'.