https://twill.io logo
Join Discord
Powered by
# ❓questions
  • t

    tfilos

    09/27/2022, 12:48 PM
    Yeah, I need to migrate them from the old site. I looked and verified that it's using Laravel relations
  • i

    ifox

    09/27/2022, 12:53 PM
    in your import code, are you using the model or the repository?
  • t

    tfilos

    09/27/2022, 1:00 PM
    The model, it appears
  • i

    ifox

    09/27/2022, 1:04 PM
    and I guess you're setting the foreign key column or using the eloquent relationship in there. I still can't see why there would be any rows ending up in the
    related
    table following that, that's impossible
  • i

    ifox

    09/27/2022, 1:04 PM
    does your artist module uses
    relatedBrowsers
    ? or maybe your browser field is in a block?
  • t

    tfilos

    09/27/2022, 1:05 PM
    My browser field is indeed in a block
  • i

    ifox

    09/27/2022, 1:05 PM
    that explains everything
  • i

    ifox

    09/27/2022, 1:05 PM
    the import is not creating those rows though, it would be when you make edits in the CMS ui
  • i

    ifox

    09/27/2022, 1:06 PM
    so on the album form, you are using the block editor and one of the block is "Artist" where you have a browser of artists?
  • t

    tfilos

    09/27/2022, 1:07 PM
    Yes, exactly
  • i

    ifox

    09/27/2022, 1:07 PM
    I'm not sure what you're trying to do so take this with a grain of salt but I don't think that should be in a block
  • i

    ifox

    09/27/2022, 1:08 PM
    everything you have (the column in db, the relationship, the $browsers property in the repository) is meant to be used with a field outside of the block editor
  • t

    tfilos

    09/27/2022, 1:33 PM
    Got it, yeah, it makes sense
  • i

    ifox

    09/27/2022, 1:57 PM
    now if you have a block to select an artist I'm assuming that's because your frontend view is rendering the artist in the part of the page that you want to manage with blocks, right?
  • k

    kalle

    09/27/2022, 1:57 PM
    Havent worked extensive with the repeaters, is there a way to have reperater in the repeater? json type
  • i

    ifox

    09/27/2022, 1:58 PM
    in Twill 3 yes, not sure about json type though
  • i

    ifox

    09/27/2022, 2:00 PM
    @tfilos if that's the case, if you have a determined position on the page for that artist block, like before or after other blocks, then render it outside of the blocks. if you want to let the admin place it in between other blocks, make it a "placeholder" block, without any field in it basically. when rendering the block, access the artist from the album model that this block belongs to, for example by passing it from
    renderBlocks
  • k

    kalle

    09/27/2022, 2:01 PM
    Ill need to switch to the blocks for this, it seems. Thank you.
  • t

    tfilos

    09/27/2022, 2:15 PM
    Thanks!
  • m

    moses

    09/28/2022, 7:16 AM
    After running composer update, I get the following exception:
    A17\Twill\Exceptions\NoCapsuleFoundException
    . Please, anyone with an idea on how I can fix this?
  • k

    kalle

    09/28/2022, 8:34 AM
    Can this be achived somehow via browser picked item?
  • k

    kalle

    09/28/2022, 8:37 AM
    @moses Can you please check this thread, its the same problem with a solution.
  • e

    epicuristic

    09/28/2022, 11:10 AM
    Hello. Is it possible to use browser on the same model that being editing? Like related projects while editing a project. Where can I find any examples?
  • h

    Harings Rob

    09/28/2022, 11:12 AM
    Hey @epicuristic that should work without any issues.
  • e

    epicuristic

    09/28/2022, 11:14 AM
    I mean, I've added formfield and its working well, but I can't find saving logic of browser data. Changes are not saving after update
  • h

    Harings Rob

    09/28/2022, 11:16 AM
    Have you used handleBrowsers or handleRelatedBrowsers?
  • i

    ifox

    09/28/2022, 11:39 AM
    not at the moment @kalle but that would be a great addition
  • i

    ifox

    09/28/2022, 11:45 AM
    @epicuristic are you looking to save it in a pivot table (project_project) or polymorphic is ok? Asking because depending on how you then use it it might have implications. The polymorphic approach with
    $relatedBrowsers
    is simpler to implement (no migration, no relationship) but has the drawback of being more complex to query (performance-wise, not code-wise), so it works well for recirculation content on a detail page, but isn't best for more complex use cases like filtering or automated content curation, where a proper belongsToMany relationship makes more sense.
  • i

    ifox

    09/28/2022, 11:48 AM
    if you want to start with the simple approach, all you should need is: - the browser field in your project form pointing to the projects module -
    use HasRelated
    in your Project model -
    protected $relatedBrowsers = ['projects'];
    in your Project repository
  • a

    amargoCactus

    09/28/2022, 4:33 PM
    Hello, can i use the tag formfield
1...408409410...484Latest