I am trying to use the ternary operator using blade to print out the active class for an <li>
tag by checking the name of the current route using the code below
<li >
However, this doesn't work and i am presented with a ParseError which says
syntax error, unexpected identifier "backend", expecting ")"
CodePudding user response:
We don't have enough information to understand what's going on.
From what I can see, the error is not on the line that you copied. Maybe try to search in the controller or in the routes file to see if there is some syntax error.
Tip: you can use Blade conditional classes to have a cleaner view.
CodePudding user response:
Instead use $request->route()->getName()
...and consider the Laravel version.