Is there any way we can add traits to the Waterhole\Models\User class in a similar way as adding relationships via the resolveRelationUsing method?
Unfortunately I don't think it's currently possible to add traits to the Waterhole User model. Again, I'll look into making the User model configurable so you can subclass it, but for now your options are to implement the desired relations manually using resolveRelationUsing
, or use your own separate User model/table and then set up the Laravel authentication integration.
Also, regarding conditional rendering, the use of a closure doesn't seem to work with the Extend remove method as it only accepts a string param. Is this method going to be updated in the future to allow for mixed content instead of only strings?
Haven't tested, but try this:
$button = TextEditor::get('mention')['content'];
TextEditor::replace('mention', fn(string $id) => $condition ? $button($id) : null);
Sounds good, for now I'll just create another user and implement traits on that model. I'll try out the code snippet you posted above as well, thanks!