[php] How to access URL segment(s) in blade in Laravel 5?

I have a url : http://localhost:8888/projects/oop/2

I want to access the first segment --> projects

I've tried

<?php echo $segment1 = Request::segment(1); ?>

I see nothing print out in my view when I refresh my page.


Any helps / suggestions will be much appreciated

This question is related to php laravel laravel-5 blade

The answer is


Try this

{{ Request::segment(1) }}

Similar questions with php tag:

Similar questions with laravel tag:

Similar questions with laravel-5 tag:

Similar questions with blade tag: