In the example a ternary is used, testing the is_admin flag on the logged in user. Be sure to retain the `intended()` function since this serves a valuable purpose.
The intended route is the name given to the place the user was trying to reach when they had to login. Imagine the situation; the user is logged in and looking at your application's dashboard or similar. They go away for a few hours then return and click on a menu item.
Since they are no longer logged in because their session expired, they can't go straight to the link and are redirected to the login page. The route that they were trying to reach is stored in session as the intended route. After logging in, if the session contains an intended route then they should be sent there.
The intended() function takes one parameter and this is a fallback route for when intended is not set.
When modifying the behaviour after login, its important to honor the intended route.