In the last tutorial we have seen a way to get text output. You can also return whole HTML code in the output, but that will make the routes file little bit ugly and hard to read. Instead of using HTML code there, view method is called. So whenever view method is called upon, it search for the view file inside the resources/views folder. These files are called blade template file. So let’s get started with it.
First we will modify the ‘/’ (root) route from the routes file i.e. we will edit routes/web.php file. Delete all content from that file and add following lines to it.
In above code, we are returning view of index. The above code will call the index.blade.php file from resources/views folder. Since this file doesn’t exists right now, we will create one. We will create file at resources/views/index.blade.php and add any HTML code which we would like to see.
Once done adding HTML code to the file, hit the php artisan serve command and visit our development site URL.
We can arrange views in folders. For example to access view file at resources/views/somefolder/somesubfolder/somefile.blade.php the return view will be like
In above example, each of the ‘.’ (dot or period character) denotes a folder.