Sunday, 11 February 2018

How to upload your project to Bitbucket or GitHub using Git
Today we are going to see how to upload our projects or files to our Bitbucket or GitHub repository through command line using Git.If you have not downloaded Git yet then download it from here with one click - Download Git. To upload our any project or files which are on our local machine, we will use some git commands to push it to Bitbucket or GitHub.If you are not aware of it then I will suggest you to read this article before you actually start uploading your project or files to Bitbucket or GitHub so that you will have some idea about git commands.Check it out that article here - What is Git ? List of Basic commands and their use.

How to upload your project to Bitbucket or GitHub using Git

We are diving this process of uploading project or files to Bitbucket or GitHub into two cases:
Case 1) If single user is working on a project
Case 2) If multiple users are working on a project

Case 1) If single user is working on a project
  • Create one repository on Bitbucket or GitHub.If you do not have an account then create one here. For Bitbucket User - Create Bitbucket Account for Free. For GitHub User - Create GitHub Account for Free
  • Copy the created repository link and go to the path in cmd where you want to keep this project(WAMP/XAMPP/MAMP/LAMP) and in cmd write "git clone url". Here you have to paste copied url in place of url and hit enter.If you are asked to enter username and password then you can enter it.
  • Go inside that folder which s just created by cloning and create your project there or you can create any html file as we are just learning it
  • In cmd, execute command "git add ." so it will add all your new created files
  • Then execute command "git commit -m 'message'", here 'message' will anything you want to write about your changes so that if you visit this folder on Bitbucket or GitHub, you will have idea about what changes you made in that commit
  • Then execute command "git push" and all your code will be on Bitbucket or GitHub repository

Case 2) If multiple users are working on a project
All the process is same as Case 1 process.You can add multiple users from settings.Every users will take clone from the repository and will set to their local machine as mentioned in above steps.

Now different users create different files on their local machine and pushes to remote repository but the user who pushes first will able to successfully add the file which he/she created.

Now when second user pushes his/her created file to repository then in command line he/she will get message that the content on the remote repository is different from the content you have on your local machine so take pull first.So second user will execute command "git pull" so the file which is pushed by first user will be on second user's local machine.Then again second user need to perform last 3 steps in case 1.

This was the thing when first user creates x.html file and second user creates y.html file but what if they both work on same file ???

If both users working on same file then first user will be able to push successfully but when second user pushes, he/she need to take pull first as discussed above and here there are two possibilities that code might merge or code get conflict.

If second user get merge then there is no issue, second user can follow last 3 steps in case 1 again and this is how second user will push code/file to remote repository but if second user gets conflict means if second user changes some code which is already different in remote repository then it will show conflict in your local repository and it will say like remote repository contains this code and your repository contains this code , in this case you can edit that code by keeping both code or removing your code or by removing remote repository's code.But second need not to remove all code , keep it in mind.Second user will remove only that much code which making conflict.

Take a look at below conflict code. "HEAD" section will contain your code and after "====" this kind of line it will be remote repository'code.It means the code which first user pushed to remote repository. 

<<<<<<<<<<<< HEAD
var x = x + y;
var x = x*y;

So, if you code is correct then do as mention below,

Keep : var x = x + y;

Remove: <<<<<<<<<< HEAD
              var x = x*y;

If, remote repository's code is correct then, do as mentioned below,

Keep : var x = x*y;

Remove: <<<<<<<<<< HEAD
              var x = x+y;

If both lines are not needed then you can remove all these lines.

Upload your project to Bitbucket or GitHub using Git

What is Git ? List of basic Git commands and their use

What is Git ?

Git is a free, open source distributed version control system tool designed to handle everything from small to very large projects with speed and efficiency. It was created by Linus Torvalds in 2005 to develop Linux Kernel. Git has the functionality, performance, security and flexibility that most teams and individual developers need.Download git for windows - Download Git
what is git

So, let us take a step back to learn all about Version Control Systems (VCS).

Version Control is the management of changes to documents, computer programs, large websites and other collection of information.

There are two types of VCS:
  • Centralized Version Control System (CVCS)
  • Distributed Version Control System (DVCS)

Centralized VCS

Centralized version control system (CVCS) uses a central server to store all files and enables team collaboration. It works on a single repository to which users can directly access a central server.

Please refer to the diagram below to get a better idea of CVCS:
centralized version control system

The repository in the above diagram indicates a central server that could be local or remote which is directly connected to each of the programmer’s workstation.

Every programmer can extract or update their workstations with the data present in the repository or can make changes to the data or commit in the repository. Every operation is performed directly on the repository.

Even though it seems pretty convenient to maintain a single repository, it has some major drawbacks. Some of them are:
  • It is not locally available; meaning you always need to be connected to a network to perform any action.
  • Since everything is centralized, in any case of the central server getting crashed or corrupted will result in losing the entire data of the project.
This is when Distributed VCS comes to the rescue.

Distributed VCS

These systems do not necessarily rely on a central server to store all the versions of a project file.

In Distributed VCS, every contributor has a local copy or “clone” of the main repository i.e. everyone maintains a local repository of their own which contains all the files and metadata present in the main repository.

You will understand it better by referring to the diagram below:
distributed version control system

As you can see in the above diagram, every programmer maintains a local repository on its own, which is actually the copy or clone of the central repository on their hard drive. They can commit and update their local repository without any interference.

They can update their local repositories with new data from the central server by an operation called “pull” and affect changes to the main repository by an operation called “push” from their local repository.

The act of cloning an entire repository into your workstation to get a local repository gives you the following advantages:
  • All operations (except push & pull) are very fast because the tool only needs to access the hard drive, not a remote server. Hence, you do not always need an internet connection.
  • Committing new change-sets can be done locally without manipulating the data on the main repository. Once you have a group of change-sets ready, you can push them all at once.
  • Since every contributor has a full copy of the project repository, they can share changes with one another if they want to get some feedback before affecting changes in the main repository.
  • If the central server gets crashed at any point of time, the lost data can be easily recovered from any one of the contributor’s local repositories.

List of Basic Git Commands and their Use

  • git clone "url" => "git clone" command will clone the repository on your local machine
  • git status => "git status" command will let you know the difference between your local repository and remote repository
  • git add . => "git add ." command will add all the files
  • git add -A => "same as "git add . " command, will add all the files
  • git add "file" => this command will add particular file
  • git commit -m "message" => this command will commit your added files, you can write whatever changes you made so other developers see this file on Bitbucket or GitHub they will know what changes you made
  • git push => "git push" command will push the committed code to Bitbucket or GitHub(Whatever you are using)
  • git pull => "git pull"command is used to take remote repository code to your local machine
  • git => this command will list out all the commands
  • git branch => this command will list all branches(default branch will be master branch)
  • git branch "child" => this command will create new branch with "child" name
  • git checkout "child" => this command will active particular branch(here e.g. child)
  • git merge "child" => this command will merge branch "child" into branch "master" but to merge child branch into master branch you must active master branch and then you can perform this command
  • git branch -d "child" => this command will delete branch "child"
  • git push --set-upstream origin child => this command will create child branch on remote repository(Bitbucket or GitHub)
  • git config --global "you email" && git config --global "you name"=> both commands will configure your email id and name so you do not need to login every time you push the code to remote repository
  • git config --unset-all --global "you email" && git config --unset-all --global "you name"=> both commands will unset your email id and name 

Saturday, 10 February 2018

How to upload files in Laravel ?
Today we are going to see how to upload single or multiples files in Laravel. Here when I use word "files" that means it can be anything like images, videos , audios or any other pdf or word document.To learn how to upload files in Laravel, first you need to setup Laravel if you have not yet.You can see here to setup your Laravel - "How to setup Laravel".

how to upload files in Laravel

How to upload files in Laravel ?

I am just deviding this upload process in three simple steps like,
1) Your View File ( Laravel blade file)
2) Your Route File
3) Your Controller

As we are uploading files and it could be large in case of videos, so first you need to open "php.ini" file which will be at xampp/php folder.If you can not find it then go to the folder and search for "php.ini".Inside that you have increase size of your post data and file upload,

search for "post_max_size" and "upload_max_filesize", you need to increase size for this two, like make it 50mb or 100mb or if you want to upload 200mb video then make it greater than 200 mb otherwise you will get error.

1) Your View File (Laravel blade file)
I am sure you have your HTML ready in your blade file to upload any file.I am putting my code as below.

For Single File Upload:
{!! Form::open(['url'=>'upload','files'=>true]) !!}
{!! Form::file('file_name') !!}
{!! Form::submit('Submit') !!}
{!! Form::close() !!}

For Multiple Files Upload:
{!! Form::open(['url'=>'upload','files'=>true]) !!}
{!! Form::file('file_name[]',['multiple']) !!}
{!! Form::submit('Submit') !!}
{!! Form::close() !!}

If you get error like "Class Form Not Found" then follow below simple steps,

1) Add below line of code to your composer.json file in require section.
"laravelcollective/html": "~5.0"

2) Open your project's root directory in cmd and run below command,
composer update

3)Add below line of code to providers section in your config/app.php file,

4) Add below line of code to aliases section in your config/app.php file,
'Form' => 'Collective\Html\FormFacade',
'Html' => 'Collective\Html\HtmlFacade',

2) Your Route File
As we have used "upload" post url in our form , let's define route for that as below,

3) Your Controller
Here we will write code as below to upload our file.Make one folder "files" inside your public folder of root directory.
public function upload(Request $request)
     //For Single File Upload:
        $file = $request->file('file_name');
        $destination_path = public_path().'/files';
        $extension = $file->getClientOriginalExtension();
        $files = $file->getClientOriginalName();
        $fileName = $files.'_'.time().'.'.$extension;

   //For Multiple Files Upload:
       for($i = 0;$i < count($request->file('file_name'));$i++)

        $file = $request->file('file_name')[$i];
        $destination_path = public_path().'/files';
        $extension = $file->getClientOriginalExtension();
        $files = $file->getClientOriginalName();
        $fileName = $files.'_'.time().'.'.$extension;

        return redirect()->back();

Video Tutorial for uploading files in Laravel

Saturday, 20 January 2018

Git Wars: GitHub vs Bitbucket
Github and Bitbucket are two of the largest web-based hosting services for source code and development projects. Unfortunately, they both don’t support the popular SVN version-control system (VCS). And they take different approaches to private vs. public repositories that affect the ease of collaboration and the risk of data exposure.


A Github account is the calling card of the software developer. Just as any writer would be asked to show their blog, every developer is expected to produce examples of their code on Github. But that does not necessarily make Github the best choice for software development teams. Github thrives on making code easy to share, and in that regard is indispensable for the open source backbone of the internet as we know it. At the same time, that means organizations must take greater care to manage their users and access control settings to ensure they are not compromising their cyber resilience. The pricing models of the two products likewise reflects their differing approaches to how to best manage code.


First of all, Github only hosts projects that use the Git VCS. That’s it. Nothing else. But Git is far and away the most commonly used VCS, so Github is still the largest code host of them all, with some 13.7 million-plus repositories of code.

Git was originally started in 2008, and was written in both Ruby and Erlang. Github is designed to encourage close communication and collaboration within development teams. To this end it includes features like highlighted code comments and collaborative code review. Other notable features are listed below.

  • An integrated issue tracker right within your project
  • Milestones and labels within projects
  • Branch comparison views
  • Native applications for Windows and Mac desktops, and also an Android app
  • Support for over 200 programming languages and data formats
  • Github pages, a feature for publishing and hosting within Github
  • Security such as use of SSL, SSH and/or https for all data transmission, and two-factor authentication for login
  • API integration for easy integration of 3rd-party tools, and integration with a large number of other tools and platforms. Some examples are Asana and Zendesk for issue/ bug tracking; CloudBees, Travis and CodeClimate for Continuous Integration (CI); AWS, Windows Azure, Google Cloud, and Heroku cloud hosting. 
  • The Github guys also recognize that SVN is also a widely used alternative to Git, so they provide a tool to import SVN repos into Git and host them on Github, although reports are that it’s at best a clunky, somewhat awkward solution. And they shrewdly made sure that Github repos are fully accessible on the SVN client.
  • Syntax highlighting. Github users will be used to this as a standard, indispensable feature, but Bitbucket notably continues to lack it.

Github pricing is free for public repos and unlike Bitbucket, doesn’t offer free private repos. For private repos, Github allows unlimited numbers of collaborators grouped into the following paid plans. The Organization plans allow a central administrator who manages teams and can set varying levels of permissions. There is also a Github version tailored for enterprises:


Right off the bat, Bitbucket’s advantage over Github is that it supports the Mercurial VCS in addition to Git. But it also doesn’t support SVN, yet. Bitbucket is written in Python and uses the Django web framework.

Bitbucket was also launched in 2008 in Australia and was originally an independent startup offering hosting only for Mercurial projects. It was acquired in 2010 by fellow Australian company Atlassian, and about a year later added support for Git repos.

Bitbucket integrates very well with JIRA, a popular project and issue-managing app. This is no surprise given that JIRA is also an Atlassian product. Other features are:

  • Pull requests and code reviews
  • Unlimited private repos
  • Branch comparison and commit history
  • Bitbucket Mac and Windows client called SourceTree; Android app called BitBeaker
  • Bitbucket for Enterprises, called Stash
  • Integration with tools like Jira, Crucible, Bamboo, Jenkins

The pricing structure differs from Git’s in that Bitbucket charges per user whereas Git charges per repository. Bitbucket allows unlimited public repos for all, but also unlimited private repos for free for up to 5 users. Beyond that, pricing is tiered as per the table below:
Max no. of usersPrice (US$ per month)Private RepositoriesPublic Repositories


Bitbucket and Github are very closely matched in terms of features if you need to use Git. And if your VCS is Mercurial, then it’s only Bitbucket for you. Each has some useful features not found in the other, such as Github pages for small web-hosting projects, or Bitbucket’s JIRA integration.

The choice may come down to the structures of your projects. If you have many private projects and small numbers of users per project, Bitbucket may be a cheaper option because of its per-repo pricing. If you have large teams collaborating on just a few projects, Github may be the better option.

Apart from pricing, the comparison chart below may also help you in your decision:
Supported VCS
Mercurial, Git
Public repos
Free, unlimited
Free, unlimited
Private repos
Free up to 5 users
Starts at $7/month for unlimited users
Jira, Crucible,
Jenkins, Bamboo
Asana, Zendesk, CloudBees, 
Travis, CodeClimate, 
AWS, Windows Azure, 
Google Cloud, and Heroku
Popular projects hosted
Adium, Mailchimp, Opera, 
Python, Django
Bootstrap, Node,js, jQuery, 
Rails, Homebrew
Notable Extra features
Spoon, Jira integration, 
External authentication via Github, Twitter, Facebook, Google
Two-factor authentication, 
Github Pages, Github Gists
Features and Directory Structure of Laravel

What is Laravel ?

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 or design pattern.It has a very rich set of features which will boost the speed of Web Development. If you familiar with Core PHP and Advanced PHP, Laravel will make your task easier. It will save a lot time if you are planning to develop a website from scratch. Not only that, the website built in Laravel is also secure. It prevents the various attacks that can take place on websites.


Laravel Features 

Laravel offers the following key features −
Configuration management
Query builder and ORM (Object Relational Mapper)
Schema builder, migrations, and seeding
Template engine
Event and command bus

If you want to use Laravel and if you do not know how to install or setup Laravel on your localhost then check it out my article on "How to setup Laravel on Windows".

Directory Structure of Laravel

Root Directory 

The root directory of Laravel contains various folders and files as shown in the following figure.The directory structure which mentioned below is for Laravel 5.4.


app − This directory contains the core code of the application.
bootstrap − This directory contains the application bootstrapping script.
config − This directory contains configuration files of application.
database − This folder contains your database migration and seeds.
public − This is the application’s document root. It starts the Laravel application. It also contains the assets of the application like JavaScript, CSS, Images, etc.
resources − This directory contains raw assets such as the LESS & Sass files, localization and language files, and Templates that are rendered as HTML.
routes – This directory contains our route file of the application.
storage − This directory contains App storage, like file uploads etc. Framework storage (cache), and application-generated logs.
test − This directory contains various test cases.
vendor − This directory contains composer dependencies.

Apart from above folders, there are some files available in root directory like ".env", ".env.example", ".gitattributes", ".gitignore", "artisan", "composer.json", "composer.lock", "package.json", "phpunit.xml", "", "server.php" and "webpack.mix.js".

App Directory 

This is the application directory. It contains a variety of additional directories, which are described below −
Console − All the artisan commands are stored in this directory.
Exceptions − This directory contains your application's exception handler and is also a good place to stick any exceptions thrown by your application.
Http − This directory contains your controllers, filters, and requests.
Providers − This directory contains various service providers.

Friday, 19 January 2018

Introduction to MVC and Popular PHP Frameworks

Introduction to MVC

The Model-View-Controller (MVC) is an architectural pattern/design pattern that separates an application into three main logical components: the model, the view, and the controller. Each of these components are built to handle specific development aspects of an application. MVC is one of the most frequently used industry-standard web development framework to create scalable and extensible projects. 

The Model component corresponds to all the data-related logic that the user works with. This can represent either the data that is being transferred between the View and Controller components or any other business logic-related data. 

The View component is used for all the UI logic of the application. 

Controllers act as an interface between Model and View components to process all the business logic and incoming requests, manipulate data using the Model component and interact with the Views to render the final output.

What is a Framework ?

It is  a collection of reusable libraries/classes. There are many libraries and classes are available in any framework which we can use in our any application whenever we need it. Like Database class, we can call it’s functions again & again whenever we need to interact with database like while inserting or updating data or for any other functionality.


15 Most Popular PHP Framework 

1) Laravel

As you can see from the previous chart, Laravel is the most popular PHP frameworks used by developers today. Even it is just still new (released February 22, 2012), but it has catch lot of developers attention. The latest version of Laravel comes as individual Composer packages. It features with good routing, easy authentication, migrations support, Blade templating engine and many more.

2) Symfony

Symfony is a flexible, scalable yet powerful PHP frameworks for MVC application. There are plenty of reusable PHP components that can can be used like Security, Templating, Translation, Validator, Form Config and more. Like Laravel, it’s alss modularize with Composer. Its goal is to make your web application creation and maintenance faster with less repetitive coding.

3) CodeIgniter

CodeIgniter is a free PHP framework maintain by EllisLab. It has an excellent documentation with large user community. There are many features that will make you taste CodeIgniter for your project such as no PHP version conflict, almost zero installation, easy error handling, easy security and encryption steps and has rich built-in libraries and helper.

4) CakePHP

CakePHP is a PHP framework that support version 4 and above. It is easy to learn with fast and flexible templating. The integrated CRUD (create, read, update and delete) is a handy feature in CakePHP for your database interaction. It also has various built-in feature for security, email, session, cookie and request handling.

5) Zend Framework

Zend Framework is a scalable and full featured object-oriented PHP framework. It’s now available in version 2 with lots of new features and improvements. It has an online training and certification which make it popular and used by plenty of enterprise organizations. With its OOP (object-oriented programming) and design patterns consistency, you can easily extend custom classes and use only what you need.

6) Phalcon

Inspired with the fastest living bird of Falcon, Phalcon framework offers the same ability which is speed. When benchmarked with other popular frameworks, it has the fastest time request and lowest memory usage according to Systems Architect and Phalcon crew test. This happen because it was purely written with C/C++ for performance optimization purpose.

7) Slim

Slim is a lightweight micro-framework for PHP inspired by Sinatra, a Ruby framework. It has a tiny size without overkill learning curve. It’s built with incredible routing system and focuses on RESTful API with all HTTP methods (GET, POST, PUT, DELETE) supports. To use it, you need at least has a PHP version of 5.2+.

8) Yii 

YiiFramework is a modern PHP framework with OOP deain system inside. Besides easy to install, it’s also highly extensible, enabling you to fit what you need. There are several tools that can help you easily tune your web application for better performance. Yii has built in integration with a great PHP testing framework, CodeCeption, to test your application easier and faster.

9) Fat-Free

Fat-Free is a powerful and easy to use PHP micro-framework. Developed by Bong Cosca in 2009, Fat-Free is one of lightweight framework with less than 50KB. It was developed almost entirely in PHP with main features of URL router, multilingual application support and cache engine. There are plentiful plugins for a large number of database back-end like MySQL, MSSQL, SQLite, Sybase, DB2, MongoDB, CouchDB, PostgreSQL and Flat File.

10) Kohana

Kohana is a PHP framework with HMVC (Hierarchical Model View Controller) architectural pattern. Kohana was built with PHP OOP in mind, which means you should you’ll get some advantages from it to have visibility protection, abstracts, automatic class loading, interfaces, overloading and singletons. The GET, POST, COOKIE, and SESSION methods can also be used as you want. To use it, you should have a minimum PHP version of 5.

11) FuelPHP

FuelPHP is a PHP framework that written in PHP 5.3, and to be able to use you also need to use the same version of PHP or above. It uses a Cascading File System inspired by Kohana. Main features are A URL routing system, RESTful implementation, HMVC implementation, template parsing, form and data validation, ORM (Object Relational Mapper), vulnerability protection and caching system. The community driven approach makes it as a flexible, modular and extensible framework.

12) Flight

Flight is an extensible PHP micro-framework. Flight has a straightforward documentation which makes you easy to learn it even you are a beginner. It is a simple and restfull framework and not recommended for big web application project. It also support routing, error handling, JSON sending and request and more.

13) PHP-Mini

Just like its name, PHP Mini is a lightweight restful PHP framework suitable for mini project and quick prototype. It has a simple but clean code and easy to understand. There CRUD demo action included for easier database entries. The code are all written natively in PHP, so you don’t need to learn additional framework.

14) Simple PHP Framework

This framework is a personal project (or project library collection) of Tyler Hall that he started since 2006. He has been dealing with hundreds of different projects and use this library for his projects base. The framework can bootstrapped your project with user authentication, database calls, RSS feeds, etc available on the code. Head over to GitHub to grab the source.

15) Zikula

Zikula is a free open source PHP framework based on Symfony and Doctrine. It can be used whether for small, enterprise or even personal projects. Zikula is well integrated with the popular Bootstrap 3 framework and Font Awesome 4. There are some pretty cool features including flexible theme system, WYSIWYG editors, ModuleStudio, document creator, galleries, chat and more.

Friday, 12 January 2018

What is new in Laravel 5.6 ?
Laravel 5.5 was released on August 30, 2017 and is the the current stable version of Laravel. Laravel 5.5 is the latest LTS(Long Term Support) version of Laravel. It is just 4 months of releasing f Laravel 5.5 and Laravel 5.6 is ready to release.

Laravel 5.6 is scheduled to be released in January 2018.Even after the release of Laravel 5.6, Laravel 5.5 will keep receiving the bug fixes as it a LTS(Long Term Support) version of Laravel.

There were many new features in Laravel 5.5.If you have not seen it yet or if you have not used Laravel 5.5 and want to use then you can see the new features in Laravel 5.5 here - Laravel 5.5 New Features.You can learn more about Laravel release process here - Laravel Release Process.If you want to get notified when new versions are released then Laravel News offer an instant notification email for new posts on their site and a weekly Laravel newsletter that you can join and be notified as soon as it's released.

What is New in Laravel 5.6 ?

1) Laravel 5.6 will Remove the Artisan Optimize Command

The Artisan optimize command is deprecated as of 5.5, and a commit in master has already removed it from 5.6. Waiting until 5.6 gives you time to update your build scripts and composer.json files ahead of the release.

As of Laravel 5.5, the composer.json no longer references optimize in the post-install-cmd and post-update-cmd scripts. The Optimize command is still defined, but does nothing in 5.5.

The 5.5 upgrade guide explains the reason for the deprecation:
With recent improvements to PHP op-code caching, the optimize Artisan command is no longer needed. You should remove any references to this command from your deployment scripts as it will be removed in a future release of Laravel.
You can see the removal in master and more discussion around the removal, where Taylor Otwell had this to say about the timing:
We’ll remove it in 5.6 and note in the upgrade guide for 5.5. It can break deployment scripts that are calling it if we remove it without warning.
Laravel 5.5 also requires PHP 7, so you should be safe to remove any reference to this command now if you’ve upgraded. Be sure to remove the command from your composer.json post-install-cmd and post-update-cmd scripts ahead of the 5.6 release next year.

2) New Blade Directives Coming to Laravel 5.6

Laravel 5.6 will include two new form blade directives for cross-site request forgery (CSRF) and HTTP method input, thanks to Taylor Otwell.

In Laravel 5.5 you do the following at the top of forms to create hidden inputs for the CSRF token and the spoofed HTTP method:
  {{ csrf_field() }}
  {{ method_field('PUT') }}
  <!-- ... -->

Starting in Laravel 5.6 you can do the following instead:
  <!-- ... -->

Laravel makes it easy to protect your site against CSRF attacks without any work on your part. However, if you want to submit a form successfully you must include a CSRF token input to verify that the form submission came from the application and not from another site.

Secondly, since HTML forms can’t make PUT, PATCH, or DELETE requests you need to add a hidden _method input to spoof these HTTP verbs. Laravel uses the _method input to route the request to the appropriate controller action correctly.

These directives will be out with Laravel 5.6 when it ships next year! Here’s the commit if you want to see the source code related to this feature.

I feel like the new directives are more instinctive and more natural to remember, however, the helper functions are still available for use if you prefer.

Wednesday, 20 September 2017

How to disable browser back button using JavaScript
This is a pure JavaScript solution "How to disable browser back button using JavaScript".If you want to disable browser back button for particular page then put below sourcecode in that particular and and if you want to disable browser back on all pages then put below sourcecode in your master page.I would not recommend you to disable your browser back button if you want to make your website user friendly.
As I said above I would not recommend you to disable your browser back button if you want make your site user friendly but if you want to implement then you do not have to do anything but just copy the sourcecode and paste in a page where you want to disable your browser back button and if you want to disable browser back button on all pages then you can put it in your master page of your website.

Disable browser back button with JavaScript


<script type="text/javascript> 
history.pushState(null, null, location.href);
    window.onpopstate = function () {

Checkout Online Demo:

Checkout our online demo for "How to disable browser back button using JavaScript" to be clear more about the solution.

                                2) How to disable browser back button using JavaScript

Sourcecode Explained:

Here you do not require any king of library as we are disabling browser back button with pure JavaScript.Just take a look at abore JavaScript sourcecode.Here we put in pushState function first argument we gave null which is title, second parameter also we gave null which will be url and third parameter we gave is a call back.

When you perform any action onpopstate will be called and history.go(1) will not let you go on previous page so this way it works.It is necessary to give callback(third parameter) in pushState function.

Demo/Video Tutorial: