Monthly Archives: November 2015

How To Do Routing In Laravel 5

By | November 27, 2015

How To Do Routing In Laravel 5

Laravel is a brilliant PHP Framework that’s equipped with tons of interesting features including RESTful routing, native PHP or light weight tempting engine and many more. Built using several Symfony components, Laravel offers you web application an amazing foundation of reliable and well-tested code.

How To Do Routing In Laravel 5

If you have worked with the Laravel framework you probably know that you can set up your routes in the following way:

However, if you use such a method your routes.php file will get hard to maintain and unreadable very soon.

Therefore, you may refactor the routes to handle the logic inside the controller like this:

This will call the hello method on the BlogController whenever a GET request is made to

Nonetheless, if you have user-controllable resources on which CRUD operations have to be performed it is best to use RESTful Resource Controllers. Using them, you follow a convention, clean up your routes file and always know what route does what.

To indicate that you will be using Resourceful Routing you only type line in your routes.phpfile instead of adding routes:

Then, your app would be expected to have a controller in charge (here it is BlogController) which has public method with certain predefined names.

After you have defined resourceful routes in routes.php, Artisan will help you create a template for the RESTful controller.

If you navigate in your Terminal to the project’s folder and type php artisan make:controller CONTROLLERNAME, Laravel will set up a Resourceful controller for you, with all necessary methods set up for you to start filling.


Figure 1: Creating a RESTful Resourceful controller in Laravel:

To ease you even further, it is possible to see all the routes that were created with the above actions so you can know how your web app should be crafted (forms, redirects and so on).

If you type php artisan route:list you would get all established routes for your app, including those set up using Route::resource.


Below, you can find a table which explains the different routes and what they are expected to do according to the convention.

Request method Route Description
POST Blog Stores a new article in the persistence layer (database)
PUT Blog/{blogEntry} Updates the current record of an article in the database
DELETE Blog/{blogEntry} Deletes a particular article (its record in the database)
GET Blog Shows all articles
GET Blog/create Displays a form to create a new article
GET Blog/{blogEntry} Shows a particular article corresponding to blogEntry – it could be an Id, a slug or other unique identifier of the article
GET Blog/{blogEntry}/edit Shows a form to edit a particular article

Now, our controller has all those actions waiting to be filled with the functionality of the resource you desire!


That’s All Guys

How to Customize YouTube Embed Player

By | November 24, 2015

How to Customize YouTube Embed Player

The post explains how to customize a YouTube embed player by using YouTube defined parameters. Nowadays most of the web developers using embed <iframe> tag for displaying videos, this improves your web project playback experience. You can stop displaying related videos using the rel parameter or removing the YouTube logo on player by using modestbranding parameter, hope this will enrich your web project experience.

How to Customize YouTube Embed Player

You can automatically play video using this.
0 -> default value
1 ->automatically plays the video

Using this parameter you can stop showing the related videos, when the initial video ends.
0 and (default)

Show video information like the tile and uploader information.
1->Before the video starts displaying,it displays information like the video title and uploader
0->will not display any info until the video is started

0->Flash player loads immediately and controls are not displayed
1->Flash player and the controls display immediately(default)
2->Controls are displayed and flash player loads once the user initiates the video.

1->prevents the YouTube logo on the player in the control bar

red(default) & white—can change the color of the progress bar either to red or white
Note: Setting the color parameter to white will disable the modestbranding option.


1->the turned off captions are shown by default
0->default value depends on user preference


1-> allows the player to respond on keyboard controls
0->player will not respond to keyboard controls(default)

1->video annotations are shown by default(default)
3->video annotations are restricted

Specify the time in seconds, when to stop playing the video from the start of the video(always from the start of the video)

fs – full screen
0->will not show the fullscreen button on the player
1->will show the fullscreen button(default)

1->causes a video to play repeatedly
0 (default)

Specify the time in seconds, when to start playing the video from the start of the video(always from the start of the video)

Recommended Parameters
You can use multiple parameters in following way.


Thanks For Reading This Tutorial. Please Comment Below .