Open mellester opened 3 years ago
I'm not sure I understand this.
My request is as follows would it be possible to make a BelongsToMany method that does the same.
What does you code actually do? Do you mean a method that removes "sensitive data" from relationships? Is that the functionallity you suggest here?
Basically I would like to access a pivot model as if it is a hasMany relation @rimace Shomthing like $user->clients->getPivotRelation
Then I could pretend like the pivot table conecting clients and user is just another Model I can do model stuf with, Like protected $cast of some fields
I was iterating over all the relations added to a specific client Model and Nulling some sensitive attributes whilst preserving the relationship itself. And I had multiple BelongToMany relation's with custom Pivot Classes and attributes. That had to be dynamically accessed. So I was wondering if this is a nice feature to have. I used they below snippet of code to turn the Attached pivots into a HasMany relation object this only works because I have custom pivots classes. And are using the default ids.
My request is as follows would it be possible to make a BelongsToMany method that does the same. Mayby Even when getPivotClass returns the default Pivot::class.