Skip to main content

Posts

Showing posts from December, 2018

Why are migrations necessary?

Why are migrations necessary? 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.

Which template engine Laravel use ?

Which template engine Laravel use ? Laravel uses Blade Templating Engine. Blade is the simple, yet powerful templating engine provided with Laravel. 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.

What is routing and how, and what are the different ways to write it?

What is routing and how, and what are the different ways to write it? All Laravel routes are defined in your route files, which are located in the routes directory. These files are automatically loaded by the framework. The routes/web.php file defines routes that are for your web interface. These routes are assigned the web middleware group, which provides features like session state and CSRF protection. The routes in routes/api.php are stateless and are assigned the api middleware group. For most applications, you will begin by defining routes in your routes/web.php file.

What is reverse routing in Laravel?

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 Using  1 Route :: get ( ‘ login ’ , ‘ users @ login ’ ) ;

What is PHP artisan. List out some artisan commands ?

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 is Lumen?

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 1 composer create - project -- prefer - dist laravel / lumen blog

What is Laravel?

What is Laravel? Laravel is free open source “PHP framework” based on MVC design pattern. It is created by Taylor Otwell. Laravel provides expressive and elegant syntax that helps in creating a wonderful web application easily and quickly.

What is Laravel Framework?

What is Laravel Framework? Laravel is a free, open-source PHP web framework, created by Taylor Otwell and intended for the development of web applications following the model–view–controller (MVC) architectural pattern.

What is HTTP middleware?

What is HTTP middleware? Middleware provide a convenient mechanism for filtering HTTP requests entering your application. For example, Laravel includes a middleware that verifies the user of your application is authenticated. If the user is not authenticated, the middleware will redirect the user to the login screen. However, if the user is authenticated, the middleware will allow the request to proceed further into the application. Of course, additional middleware can be written to perform a variety of tasks besides authentication. A CORS middleware might be responsible for adding the proper headers to all responses leaving your application. A logging middleware might log all incoming requests to your application. There are several middleware included in the Laravel framework, including middleware for authentication and CSRF protection. All of these middleware are located in the app/Http/Middleware directory.

What is dependency injection 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. 1 https : //en.wikipedia.org/wiki/Dependency_injection You can do dependency injection via Constructor, setter and property injection.

What is database migration. How to create migration via artisan ?

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. Use below commands to create migration data via artisan. 1 2 // creating Migration php artisan make : migration create_users_table

What is database migration? And how to use it to add insert initial data to database?

What is database migration? And how to use it to add insert initial data to database? Migrations are like version control for your database, allowing 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. If you have ever had to tell a teammate to manually add a column to their local database schema, you’ve faced the problem that database migrations solve. Laravel includes a simple method of seeding your database with test data using seed classes. All seed classes are stored in the database/seeds directory. Seed classes may have any name you wish, but probably should follow some sensible convention, such as UsersTableSeeder, etc. By default, a DatabaseSeeder class is defined for you. From this class, you may use the call method to run other seed classes, allowing you to control the seeding order.

What is composer ?

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 directories that need to be writable laravel installation?

What directories that need to be writable laravel installation? After installing Laravel, you may need to configure some permissions. Directories within the storage and the bootstrap/cache directories should be writable by your web server or Laravel will not run. If you are using the Homestead virtual machine, these permissions should already be set.

What are traits in Laravel?

What are traits in Laravel? PHP Traits are simply a group of methods that you want include within another class. A Trait, like an abstract class cannot be instantiated by itself.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. Here is an example of trait. 1 2 3 4 5 6 7 8 trait Sharable {    public function share ( $ item )    {      return 'share this item' ;    } } You could then include this Trait within other classes like this: 1 2 3 4 5 6 7 8 9 10 11 class Post {    use Sharable ; } class Comment {    use Sharable ; } Now if you were to create new objects out of these classes you would find that they both have the share() method available...

What are the main differences between Laravel 4 and Laravel 5.x?

What are the main differences between Laravel 4 and Laravel 5.x? 1. Summarizing Laravel 5.0 Release notes from the above article: 1. The old app/models directory has been entirely removed. 2. Controllers, middleware, and requests (a new type of class in Laravel 5.0) are now grouped under the app/Http directory. 3. A new app/Providers directory replaces the app/start files from previous versions of Laravel 4.x. 4. Application language files and views have been moved to the resources directory. 5. All major Laravel components implement interfaces which are located in the illuminate/contracts repository. 6. New route:cache Artisan command to drastically speed up the registration of your routes. 7. Laravel 5 now supports HTTP middleware, and the included authentication and CSRF “filters” have been converted to middleware. 8. you may now type-hint dependencies on controller methods. 9. User registration, authentication, and password reset controllers are now included out of the box, as...