Skip to content
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

Merged
merged 2 commits into from
Apr 3, 2024
Merged

Conversation

siberfxweb
Copy link
Contributor

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 :)

if route prefix is defined, better to get it from backpack route prefix
Copy link

welcome bot commented Apr 2, 2024

BOOM! Your first PR with us, thank you so much! Someone will take a look at it shortly.

Please keep in mind that:

  • if this constitutes a breaking change, it might take quite a while for this to get merged; we try to emulate the Laravel release cycle as much as possible, so developers can upgrade both software once; this means a new big release every ~6 months;
  • even if it's a non-breaking change, it might take a few days/weeks for the PR to get merged; unless it's a no-brainer, we like to have some community feedback on new features, before we merge them; this leads to higher-quality code, in the end; we learnt this the hard way :-)
  • not all PRs get merged; sometimes we just have to hold out new features, to keep the packages lean; sometimes we don't include features that only apply to niche use cases;
  • we're not perfect; if you think we're wrong, call us out on it; but in a kind way :-) we all make mistakes, best we learn from them and build better software together;

Thank you!

--
Justin Case
The Backpack Robot

$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'))
Copy link
Contributor

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

Copy link
Contributor Author

@siberfxweb siberfxweb Apr 2, 2024

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 ?

Copy link
Contributor Author

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

@pxpm pxpm self-assigned this Apr 2, 2024
updated with conditional :)
@siberfxweb siberfxweb requested a review from pxpm April 2, 2024 19:53
@pxpm pxpm merged commit 6096cbb into Laravel-Backpack:main Apr 3, 2024
1 of 2 checks passed
Copy link

welcome bot commented Apr 3, 2024

WHOOP-WHOOP! Congrats, your first PR on this repo has officialy been merged.

party

If you want to help out the community in other ways, you can:

  • give your opinion on other Github Issues & PRs;
  • chat with others in the Gitter Chatroom (usually for quick help: How do I do X);
  • answer Backpack questions on Stackoverflow; you get points, people get help; you can subscribe to the backpack-for-laravel tag by adding a new filter; that will send you emails when new questions come up with our tag;

Again. Thank you for the PR. You are a wonderful person. Keep 'em coming :-)
Cheers!

--
Justin Case
The Backpack Robot

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!

@pxpm
Copy link
Contributor

pxpm commented Apr 3, 2024

Hey @siberfxweb sorry to know that :(

I recognized the name, sometimes people use different handles, one for job another for personal projects.
It would be better if that was the case here and not a ban :(

Hope you can sort that out shortly 🙏

Thanks for the PR, very much appreciated.

Cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants