-
Notifications
You must be signed in to change notification settings - Fork 328
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
Don't assume model App\User #21
Comments
Actually, it already takes care of the configuration. The auth config file has changed as of Laravel 5.2 and Bouncer seems to not have been updated since. It happens in BouncerServiceProvider on line 130:
In Laravel 5.2 you should use:
I could propose a pull request, but I'm not sure the best way to do it :
|
Anyway, I understand that the use of |
I'm using Laravel 5.1 for this so Regarding the pull request, the way most packages handle this is by having a different version for each supported Laravel version... So for example Bouncer 0.1 works with 5.1 and 0.2 works with 5.2 |
Was using 5.1 last week, 5.2 now (project still in development) and never had the problem you mention. I've done exactly what @andradedev described in #25 on a fresh install:
Then, I have the following error:
Ok. Edit BouncerServiceProvider file to change the auth config key to user model as I mentioned, remove tables creating before failing migrations and run
No error and |
I forked the repo and replaced |
Even if it's working for me, it's still not very difficult to remove |
@JosephSilber I don't think the PR solves the issue. Model |
Have you tried it? Did you get an error? If so, can you please post the stack trace here? |
The error is that
|
As I explained, this error happened because auth configuration file changed as of Laravel 5.2. Therefore, default was to use |
@jonagoldman without a stack trace, I can't tell what's wrong. Please provide a full stack trace so that we can figure this out together. Thank you. |
I could not get the error so I went trough the code. Not sure why PHP internals it's ok with this, but it just don't look right to me. Man it's your package and your call. Maybe I don't understand something. I'm just pointing it out. |
That's exactly what I meant when I said it was a key. Yes, for PHP it's ok, even if the class does not exist... I would have proposed to remove |
To summarize:
If I've summarized it all correctly, I think there's no point for future discussion here. Have I missed anything? |
👍 |
About PHP being OK: http://php.net/manual/en/language.oop5.changelog.php#117688
|
@jonagoldman thanks for following through. I appreciate all the feedback, even if I don't always agree with everything. ❤️ |
@Arcesilas I actually looked for that but could not find it, thanks! |
Hi, this is pretty old, but the problem persists. For example in IsRole.php
If I modify the package, an update will overwrite the fix, overriding all the methods to use the custom path will be too complex. How should I overcome this? edit: edit2: Thanks! |
@dhcmega what exactly is the problem? Bouncer actually does use the user specified in the auth config. Have you tried it? |
In role for example: https://github.com/JosephSilber/bouncer/blob/master/src/Database/Concerns/IsRole.php It has line9: use App\User; May be I'm wrong, I have just started using this package. |
Been a long time, but I remember it has already been answered: |
I will do some tests and get back if I can't work it out.. I'm using App\User for auth, but App\Models\User for CRUD. Thanks! |
Model
App\User
is hard-coded in various classes:Silber\Bouncer\Database\Models
Silber\Bouncer\Database\Ability
Silber\Bouncer\Database\Role
It is possible to make it configurable?
The text was updated successfully, but these errors were encountered: