-
Notifications
You must be signed in to change notification settings - Fork 166
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
php artisan backpack:extend-permissionmanager #23
Comments
Hey @tabacitu , when I forked and did this for my project I just add this to PermissionManagerServiceProvider: I altered the default controllers and requests to have the right namespaces though and also altered the route group namespace, how would you setup this to cater for both cases? |
I guess the proper procedure would be very similar, but automated. So the commands wouldn't be defined as "publish" commands, as they would need to do some extra stuff too. I think the best place to put a command like this would be inside Then the
CRUD::resource('permission', 'PermissionCrudController');
CRUD::resource('role', 'RoleCrudController');
CRUD::resource('user', 'UserCrudController'); To sum up, honestly, I think the code is pretty different. It's more work to automate it, so I don't think merging with your fork makes sense right now. I would be very very happy to merge, however, if you did it this automated way :-) It would be a big help for me personally and I think, for hundreds/thousands others that use the package. Cheers! |
Simply extending the BP Role and Permission Class within my own and using the config file to adjust the table names has already gotten me pretty far. Going to need a bit more time to look into this properly. |
I wanted to extend the Controller, Request & Model. However, The CRUD Controller throw me the exception for the extended class from original PermissionCrudRequest
|
@kiddtang your |
@OliverZiegler I did that but the Warning still there... I am overriding
My Controller then use the
|
@kiddtang Have you solved your issue , because i am facing the exact same error in my project.. |
@abdelrahmanahmed
So my function could override the default behavior. Hope it could help you. |
I'm also facing this issue. But I don't like the idea to manually overwrite the vendor files. What I did was to write the validations inline, inside the extended controller. You can accomplish that by just writing inside the $request->validate([
'name' => [
'required',
'min:10',
],
]); Of course, you can extract your validation to another method and call it instead of writing this twice. |
Hey everyone! I no longer think this is worth doing. I think it's one of those cases where clear documentation eliminates the need for a feature. And I think this section provides clear instructions on how to customize any class this package provides. Plus, we shouldn't make it too easy for people to extend this and customize... if they do that without knowing what they're doing... that's a recipe for disaster 😔 So I'm going to close the issue. This wasn't a priority anyway, so it's unlikely we would get to it this year either. Better closed than "never done". Let me know if you disagree. I'm wrong at least once a day, like everybody else 😀 Cheers! |
A command that makes overwriting default functionality easier.
An artisan command that creates blank controllers, requests and models. Those classes:
So that the developer would only need to write the logic for the method they want to overwrite.
The text was updated successfully, but these errors were encountered: