Laravel 5: How to stay on the same page after login?

I have been google it and find a few ways to do it. But I think the method below is the quicker way.

You can modify your route in routes.php like this:

Route::get( 'page-slub'
'middleware' => 'auth',   // so it will required authentication
'uses' => 'yourPageControllerClass@handler'

That’s it. All you need is the add the “middleware” authentication into your Route. Then it should redirect you back to the previous page after the login.

Hope this help.

Laravel 5: Get the HTML Output from a View Object

Normal we can use view object to generate the layout and html content. But in here what happen if we want to use the View object to help generate the html out as a string that we can pass around with in the code?

In Laravel 5, we could  use view($template_name, [“keyname” => $arg, …..]) ->render();  to get the HTML string. However the story is not going to end here…

Now you have a string with all the HTML tags and attributes, but if you use {{ display }}, it won’t work.

  • Because {{ …. }} escape HTML by default, to prevent HTML injection.

Hence, you will need to use {!! … !!} to print the raw HTML.

Clear or Prevent Caching on a Page

Sometime we might want to disable the caching for development or unwanted cache effect on the live site. Although cache is useful and help improve performance, but this doesn’t mean it is always a good things.

There is time, mostly during development when I constantly need update and make code changes for testing and debugging, caching can be ignoring and confusing for the outcome. In this case you want want to use the following meta tags to stop caching on your pages.


For more information please referring to this following link.
Useful HTML Meta Tags