Showing posts with label if clause. Show all posts
Showing posts with label if clause. Show all posts

Saturday, February 11, 2017

How to get the current URL inside @if statement (blade) in Laravel

It is sometimes you need to control your view page(.blade.php) based on url visited by user. You can check if user visited by a Controller or Controller+Action both. It can be now done by Laravel very easily. Below is code snippet to do the tricks.

@if (Request::is('controller/*'))
    <!-- code block here -->
@endif

@if (Request::is('controller/action'))
    <!-- code block here -->
@endif