Comments (3)
I haven't dived so much in the code, but it seems this is the way polymorphic relations work. So I think it has to be here, not anywhere else.
from bouncer.
Looks like a Morph Map could fix this issue.
Some people had this issue too and they added to the laravel repo what seems to be an undocumented method to map a string to a class name. See laravel/framework#9839
Will give it a try later and update.
from bouncer.
Look at this Laravel PR if you want to use the table names instead of the model class names.
Simply add this to your AppServieProvider
's register
method:
Relation::morphMap([
App\Post::class,
]);
Add all of the models you use into that array (remember to import the Relation
's namespace).
This is what I personally do for all my morphing models.
from bouncer.
Related Issues (20)
- Frontend - Check if user can own a model HOT 1
- Ability Options Bouncer::can not return abilities or mistake HOT 1
- Ability Cast Blocks UUID on 'entity_id' HOT 2
- Bouncer::role() return empty array HOT 2
- User::roles() returns empty collection when scope is null HOT 12
- Get Direct Abilities - Not via Roles HOT 2
- setup with filament not working HOT 1
- No migrations when upgrading from 1.0.0-rc.3 HOT 1
- Question: How can I get certain model Instance's users with ability 'update' ? HOT 1
- Can helper returning true after removing role from the user HOT 2
- error foreign keys with Planetscale HOT 3
- How To Add / Remove Roles Temporarily (for current request only) ? HOT 5
- [HELP] Extend Ability HOT 1
- Migration issues using Multitenancy System HOT 8
- Get all users with all their roles HOT 2
- scope is not reset between tests HOT 3
- Fine grade check delete ability
- Adjust connection for can() gate
- How to get owns and check is owned
- Is it possible to keep all abilities hardcoded instead of abilities table HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bouncer.