Laravel-Backpack / PermissionManager

Admin interface for managing users, roles, permissions, using Backpack CRUD
http://backpackforlaravel.com
Other
527 stars 168 forks source link

How to customize crud for 'user'? I am using a different model #263

Closed realtebo closed 3 years ago

realtebo commented 3 years ago

Bug report

It's not a bug, but a need for help or just a lack of documentation for customizations

What I did:

I am already using laravel-permission succesfully.

I added later permission manger package to my project [it's at very early stage, so no difficult]

The only difference with standard usage is that I am using a custom model class.

So I specified the righe class in config/backpack/permissionmanager.php

What I expected to happen:

Nothing of specific

What happened:

Obviously the crud for my custom model, that is using additional fields is missing additional table fields

What I've already tried to fix it:

I googled but without success

Backpack, Laravel, PHP, DB version:

Latest of all at today. My project's packages are updated on daily basis in this phase

What I need

I don't understand of to customize crud controller of User, to remove some field and add some others.

welcome[bot] commented 3 years ago

Hello there! Thanks for opening your first issue on this repo!

Just a heads-up: Here at Backpack we use Github Issues only for tracking bugs. Talk about new features is also acceptable. This helps a lot in keeping our focus on improving Backpack. If you issue is not a bug/feature, please help us out by closing the issue yourself and posting in the appropriate medium (see below). If you're not sure where it fits, it's ok, a community member will probably reply to help you with that.

Backpack communication mediums:

Please keep in mind Backpack offers no official / paid support. Whatever help you receive here, on Gitter, Slack or Stackoverflow is thanks to our awesome awesome community members, who give up some of their time to help their peers. If you want to join our community, just start pitching in. We take pride in being a welcoming bunch.

Thank you!

-- Justin Case The Backpack Robot

pxpm commented 3 years ago

Hello @realtebo

To overwrite ANY file you need in ANY package there is a simple solution that is:


//In some service provider:

$this->app->bind(
        \Backpack\PermissionManager\app\Http\Controllers\UserCrudController::class, //this is package controller
        \App\Http\Controllers\Admin\MyCrudController::class //this should be your own controller
    );

Everytime your application requires the package UserCrudController your own MyCrudController will be served.

There is also another method described by @promatik here:

https://github.com/Laravel-Backpack/PermissionManager/issues/261#issuecomment-751527029

We use github for bugs/features only, I will let the bot close this issue so you get the links to our other mediums where you can ask more general questions like this.

Wish you the best, Pedro

support[bot] commented 3 years ago

Oups!

Looks like this is a support request, not a bug/feature. Could you please repost on StackOverflow, using the backpack-for-laravel tag?

Background: Here at Backpack we use Github Issues only for tracking bugs and features, not individual implementation issues. This helps a lot in keeping our focus on improving Backpack. Thanks a lot for understanding!

Here are all the Backpack communication mediums:

Please keep in mind Backpack offers no official / paid support. Whatever help you receive here, on Gitter, Slack or StackOverflow is thanks to our awesome awesome community members, who give up some of their time to help their peers. If you want to join our community, just start pitching in. We take pride in being a welcoming bunch.

Thank you!

-- Justin Case The Backpack Robot

PS. In case I mistakenly closed your issue, yell :-) I'm a robot, I make mistakes.

realtebo commented 3 years ago

Your solution and then linked one are both working. So thanks.

But this is a DOC ISSUE, so please, expand the doc to document this case.

And ... I have paid an unlimited license.... is there any support email for paying customers? IMHO: SO it's a stupid jungle

pxpm commented 3 years ago

@realtebo thanks for feedback.

But technically, knowing how to overwrite some PHP class (is what we are talking about here), either via regular overwrites (replace url and controller like @promatik suggested) or using Laravel specific functionality (with ->bind()) it's not Backpack "responsability" to teach users how to do that.

But I 100% agree with you that it would not hurt us to have a reference of some sort in our documentation, I will send a PR to the docs to include this note.

About licensing, the license does not grant support (neither email or other mediums), all support we give to users is "free" in the sense of that is not included in the license price, but we push ourselfs hard to try to do a good job in that matter to.

So technically yes, you have support, but it's not a paid one.

I hope I made myself clear here, if you have any doubts I am going nowhere, so you can ask and I will try to rephrase something that you didn't understood.

In SO we use a specific tag to identify backpackers, but if you are more of a chatty person, I would recommend gitter instead.

https://gitter.im/BackpackForLaravel/Lobby

https://stackoverflow.com/questions/tagged/backpack-for-laravel

Let's try to make your experience smooth (is what we aim for), if you have any questions just write them, even if silly it can spare you some time digging for the answer, nobody is going to judge, we have a nice and peacefully community.

Wish you the best, Pedro