Comment #⁨6⁩

In reply to Toby Toby

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? I was trying to conditionally remove some of the buttons in the text editor but it seems they are hard coded, so using the replace method wasn't viable (source code).

  1. Toby Toby Waterhole Founder Apr 30, 2024
    In reply to Stormlight Stormlight

    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);