SyntaxFix
Write A Post
Hire A Developer
Questions
An easy way to get the first or last segment, in case you are unsure of the path length.
$segments = request()->segments(); $last = end($segments); $first = reset($segments);