Creating a gallery application in Laravel 5.1 – part 3

In this third part of the series, I will create a form in Laravel using which we can add a new Gallery into the database. And also there will be a listing of all the galleries currently preset in the database. And then I will also handle the route where once we pass the gallery id, we will be able to view the details of the Gallery.

To start off, we will create the form. Now Laravel 5 comes with a new middleware which looks for a CSRF token on all POST routes. This is a validation which checks if the POST is coming from a valid source and I personally feel it’s a great security feature. Once we add the token to validate the CSRF, we will go through rest of the form (typical stuff) and then handle the save method on the POST route.

With that, then we will work on the listing page and clicking on a link will take us to the detail page of the gallery.