Closed c-fitzmaurice closed 3 years ago
Firstly, Fortify allows you to specify a route prefix to all routes. So whilst I agree route customisation would be nice, I'm not sure your example will work.
Let's take your example:
/{username}/profile
In order to make this possible, you would need to always assume that the username
wildcard will resolve for the current user. I'm personally not a fan of this as I've always had the philosophy that assumptions are bad in programming. This would also mean that routes such as /foo/profile
would resolve and allow you to view the your profile, given the current controller logic. I suspect this isn't the effect you're looking for?
One alternative is to change the logic used to resolve the user and use the username
route wildcard. The complexity here is that a UserPolicy
will need to be implemented as well as user.view
files, so that when visiting other users profiles, you do not end up modifying (or worse, deleting) that profile. I suspect this kind of change is unlikely to get Taylor's approval due to the maintenance burden associated with the complexity.
The final alternative is to publish the routes file using
php artisan vendor:publish --provider="Laravel\Jetstream\JetstreamServiceProvider" --tag=jetstream-routes
Then modifying your RouteServiceProvider
to load the routes from the published routes/jetstream.php
file.
@c-fitzmaurice Please see the answer above.
@joelbutcher thanks!
Thanks @joelbutcher !
In the Jetstream config file there is no way to adjust the routes, like the Fortify config file. It would be great if we could customize the user profile URLs. I would like to use my User Model's
username
field as a slug for the user profile:from
to
IIf this is something that would be considered useful I could maybe start looking into a PR.