laravel get url segment
snippet in php

laravel get url segment

user7950

{{ Request::segment(1) }}

get url segment in php

user5583

$uri_path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
$uri_segments = explode('/', $uri_path);

echo $uri_segments[0]; // for www.example.com/user/account you will get 'user'