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

前端 未结 28 2637
眼角桃花
眼角桃花 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:34

    I personally wouldn't try grabbing it inside of the view. I'm not amazing at Laravel, but I would imagine you'd need to send your route to a controller, and then within the controller, pass the variable (via an array) into your view, using something like $url = Request::url();.

    One way of doing it anyway.

    EDIT: Actually look at the method above, probably a better way.

提交回复
热议问题