-
Notifications
You must be signed in to change notification settings - Fork 64
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
Rename make commands #41
base: main
Are you sure you want to change the base?
Conversation
From `backpack:crud-controller` to `backpack:make:controller`
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! -- |
I agree the commands need an update. We really didn't think ahead when we created this 2 years ago. We do have another issue, though - we have our own convention, ever since the installation commands. Every Backpack package has its own installation command under its package name. Ex:
And I think we should keep this convention going forward, and all Backpack packages (and extension) should prefix their commands with their package name. This way we can make sure we don't have overwritten commands: backpack:crud-> backpack:make:crud -> backpack:generators:make:resource
backpack:crud-controller -> backpack:make:controller -> backpack:generators:make:controller
backpack:crud-model -> backpack:make:crud-model -> backpack:generators:make:crud-model
backpack:crud-request-> backpack:make:crud-request -> backpack:generators:make:crud-request
backpack:model -> backpack:make:model -> backpack:generators:make:model
backpack:request -> backpack:make:request -> backpack:generators:make:request
backpack:view -> backpack:make:view -> backpack:generators:make:view Please keep the above in mind. I don't think it's a good solution, but I think it's the only way we could change the commands while respecting all conventions. Now let me go on a rant about "the best" way in my opinion: |
Backpack\MakeSo how about... we create a new package to replace Backpack/Generators? :-) Crazy, I know. But hear me out. Different package, different name, different command namespace ( It's also a different package, so you'd expect things to be different. No backwards compatibility needed. Solves that problem. Right now in Generators we have a bunch of commands I don't think anybody uses. We can just keep the useful commands, mainly Generated controllers use Right now generated CRUDs don't have routes. You have to do it manually. But we now have a command for it, we can automatically generate the CRUD::resource(). Solves that problem. Right now generated CRUDs don't insert an item in the menu. You have to do it manually. But we now have a command for it, we can automatically generate a sidebar item. Solves that problem. To get a glimpse of how I see this happening, because I also see this php artisan backpack:make:crud
#notice: no extra parameters; you don't have to remember if it's singular, plural, etc; just the command, which is simple to remember or can even be php artisan make:crud, but that would break the backpack convention
> ----------------------
> | Making a new CRUD |
> ----------------------
> Please answer a few questions:
>
> What is the TABLE NAME? (ex: products; db table where your entries are stored)
tags
> What is your entity name, in PLURAL? (ex: products; used for showing buttons like Edit Products)
tags #sensible default is provided, just have to hit Enter most of the times
> What is your entity name, in SINGULAR? (ex: product; used for showing buttons like Add Product)
tag #sensible default is provided, just have to hit Enter most of the times
> What you like to generate a ROUTE in routes/backpack/custom.php?
yes #defaults to yes, just have to hit Enter most of the times
> What you like to add a SIDEBAR ITEM in resources/views/vendor/backpack/base/inc/sidebar_content.blade.php?
yes #defaults to yes, just have to hit Enter most of the times
> What ICON would you like it to have?
fa fa-list #defaults to something, anything
> Would you like to open the files after generation? If so, please type your IDE handle (ex: subl, pstorm, vscode)
no #defaults to no
> --------------
> | Thank you! |
> --------------
> Generated App\Models\Tag.php
> Generated App\Http\Requests\TagRequest.php
> Generated App\Http\Controllers\Admin\TagCrudController.php
> Added route in config/backpack/custom.php
> Added sidebar item in resources/views/vendor/backpack/base/inc/sidebar_content.blade.php
> ------------------------
> Done! Please take a look at the generated files and modify as you like.
> ------------------------
Additionally we could have a long list of questions, for all kinds of customizations, but with a different flag, for example > [OPTIONAL] Where would you like the Model to be generated? (model namespace)
App\Models #sensible default is provided, just have to hit Enter most of the times
> [OPTIONAL] Where would you like the CrudController to be generated? (controller namespace)
App\Http\Controllers\Admin #sensible default is provided, just have to hit Enter most of the times
> [OPTIONAL] Where would you like your Request to be generated? (request namespace)
App\Http\Requests #sensible default is provided, just have to hit Enter most of the times But that's less important. What I do think is important is that we do this AT THE RIGHT TIME. And I think that's when we render There. I said it. The entire plan :-) What do you think? PROs:
CONs:
|
@OwenMelbz , @eduardoarandah , @lloy0076 , @OliverZiegler , @iMokhles if you guys have time to read my rant above, please do. I've included ALL my ideas about how we can improve CRUD generation. I expect this to make it even faster to generate CRUD panels - down from 10 minutes to something like 10 seconds (once you have the migration/table ready, of course). So a HUGE improvement. Would love your opinions on this too. |
So does this make this PR completely redundant, @tabacitu? Or is it worth going through with it? |
Also, this may completely break something that someone has written - why someone would script artisan commands is beyond me, I don't know however changing command names isn't to be done lightly. @AbbyJanke @tabacitu If this goes through, the documentation in various OTHER places may neeed changing too. |
@lloy0076 yes, that Make package would make this PR redundant. Yes, it would completely change the docs. But for the better, I think :-) |
So at this point I would suggest looking at I think this does everything you describe and can be extended for people’s own use. The Furthermore you could use this as base for other generators. |
Thank you, @OliverZiegler I tried to provide an option that you can define your own naming conventions by using your own naming classes. The explanation for this part of the package is still missing in the readme - I will add it as soon as possible. |
I added the "naming" part in the readme of that package. I hope this will help - I'm not good in writing documentation... |
Hi there! Is this still an issue? No activity in 60 days. I'm going to mark it as stale for now, and close it in 14 days if no further activity occurs. I know you guys are all busy, but if this is important to you please reply or something, so I know not to close it. Thank you! -- |
Mm gonna toss this thought out: soo with the Nova release they are usung things like ‘nova:resource’ so maybe what we have currently is best option? |
Hi there! Is this still an issue? No activity in 60 days. I'm going to mark it as stale for now, and close it in 14 days if no further activity occurs. I know you guys are all busy, but if this is important to you please reply or something, so I know not to close it. Thank you! -- |
Oh. My. God. OH MY GOD! @tswonke , @OliverZiegler , I like your laravel-generators packages so so much. Miles ahead of this one. Great job! I think there are a few improvements needed for better usability (mostly documentation), but that’s to be expected - as a developer it’s difficult to intentionally “forget” how it works and put yourself in the shoes of someone using it for the first time. In the next few days I’ll hopefully be able to dedicate some time to using the package again and again, propose some changes and write the PRs. Awesome work guys!!! After the few usability changes I have in mind, I’d love for your package to become the “official” generators package for Backpack, instead of this one + laracasts. Would that be ok with you? (anybody else, if you haven’t tried their package yet - do it now. it works GREAT) |
Thank you @tabacitu ! :-) I started the package primarily to optimize our own development process, but always had in mind that this could be useful for others too. That's why we tried to make it customizable, but we know that there is still work to do. Your help and ideas are always welcome and of course we are pleased getting "official" ;-) - maybe after some issues have been solved. |
Hi there! Is this still an issue? No activity in 60 days. I'm going to mark it as stale for now, and close it in 14 days if no further activity occurs. I know you guys are all busy, but if this is important to you please reply or something, so I know not to close it. Thank you! -- |
Hi there! Is this still an issue? No activity in 60 days. I'm going to mark it as stale for now, and close it in 14 days if no further activity occurs. I know you guys are all busy, but if this is important to you please reply or something, so I know not to close it. Thank you! -- |
Hi there! Is this still an issue? No activity in 60 days. I'm going to mark it as stale for now, and close it in 14 days if no further activity occurs. I know you guys are all busy, but if this is important to you please reply or something, so I know not to close it. Thank you! -- |
Hi there! Is this still an issue? No activity in 60 days. I'm going to mark it as stale for now, and close it in 14 days if no further activity occurs. I know you guys are all busy, but if this is important to you please reply or something, so I know not to close it. Thank you! -- |
Hi there! Is this still an issue? No activity in 60 days. I'm going to mark it as stale for now, and close it in 14 days if no further activity occurs. I know you guys are all busy, but if this is important to you please reply or something, so I know not to close it. Thank you! -- |
Hi there! Is this still an issue? No activity in 60 days. I'm going to mark it as stale for now, and close it in 14 days if no further activity occurs. I know you guys are all busy, but if this is important to you please reply or something, so I know not to close it. Thank you! -- |
Hi there! Is this still an issue? No activity in 60 days. I'm going to mark it as stale for now, and close it in 14 days if no further activity occurs. I know you guys are all busy, but if this is important to you please reply or something, so I know not to close it. Thank you! -- |
Hi there! Is this still an issue? No activity in 60 days. I'm going to mark it as stale for now, and close it in 14 days if no further activity occurs. I know you guys are all busy, but if this is important to you please reply or something, so I know not to close it. Thank you! -- |
Renaming Backpack generator commands to follow more accurate Laravel schema:
I know it is a little longer to type, however I feel that it sticks with standard laravel console schema better and clarifies what it does better.