How to Get the Current URL Inside @if Statement (Blade) in Laravel 4?

前端 未结 28 2639
眼角桃花
眼角桃花 2020-11-28 01:15

I am using Laravel 4. I would like to access the current URL inside an @if condition in a view using the Laravel\'s Blade templating engine but I don\'t know ho

28条回答
  •  青春惊慌失措
    2020-11-28 01:35

    To get current url in blade view you can use following,

    Current Url
    

    So as you can compare using following code,

    @if (url()->current() == 'you url')
        //stuff you want to perform
    @endif
    

提交回复
热议问题