-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update CrudBackpackCommand.php #205
Conversation
if route prefix is defined, better to get it from backpack route prefix
BOOM! Your first PR with us, thank you so much! Someone will take a look at it shortly. Please keep in mind that:
Thank you! -- |
$url = Str::of(config('app.url'))->finish('/')->append('admin/')->append($nameKebab); | ||
$url = Str::of(config('app.url'))->finish('/') | ||
->append( | ||
(!empty(config('backpack.base.route_prefix')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @siberfxweb thanks for the PR.
Totally agree with this change. Just 2 things that I would have prefer to address in a different way:
1 - this ternary condition became a little bit difficult to read, we should probably create a variable above like $routePrefix = ....
and then ->append($routePrefix)
.
2 - I think it's safer if we do ->append($routePrefix)->finish('/')
and avoid manually adding the /
. finish()
will take care to add the /
if it doesn't exist and does not duplicate it in case it's already present.
If you agree with me, do you mind doing the changes ?
Cheers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but what if we use it with empty string, I mean backpack works on the root, then double slashes will be added, how do you think ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw, github for idk what reason, marked my main account as spam and no responses, even I was using pro :/ usually its me siberfx
updated with conditional :)
WHOOP-WHOOP! Congrats, your first PR on this repo has officialy been merged. If you want to help out the community in other ways, you can:
Again. Thank you for the PR. You are a wonderful person. Keep 'em coming :-) -- P.S. Help in the Backpack community is rewarded with free Backpack commercial licenses. It's the least we can do. If you feel you've helped the community with PRs, help & other stuff, please shoot Tabacitu an email and ask him if you qualify for free licenses. You scratch my back, I scratch your back. Thank you! |
Hey @siberfxweb sorry to know that :( I recognized the name, sometimes people use different handles, one for job another for personal projects. Hope you can sort that out shortly 🙏 Thanks for the PR, very much appreciated. Cheers |
WHY
if route prefix is defined, better to get it from backpack route prefix
BEFORE - What was wrong? What was happening before this PR?
before it was static value with "http://domain.ltd/**admin**/
AFTER - What is happening after this PR?
now it is dynamic value with whatever being set backpack.base.route_prefix "http://domain.ltd/**defined_path**/
How did you achieve that, in technical terms?
if route prefix is defined, better to get it from backpack route prefix
Is it a breaking change or non-breaking change?
no
How can we test the before & after?
you dont need to :)