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

    user

    07/06/2021, 2:48 PM
    My config
    Copy code
    php
    'enabled' => [
            'buckets' => true,
        ],
    
        'buckets' => [
            'homepage' => [
                'name' => 'Homepage',
                'buckets' => [
                    'post_feature' => [
                        'name' => 'Featured Blog - Big',
                        'bucketables' => [
                            [
                                'module' => 'posts',
                                'name' => 'Posts',
                                'scopes' => ['published' => true],
                            ],
                        ],
                        'max_items' => 1,
                    ],
    
                    'post_top' => [
                        'name' => 'Side Feature - Top',
                        'bucketables' => [
                            [
                                'module' => 'posts',
                                'name' => 'Posts',
                                'scopes' => ['published' => true],
                            ],
                        ],
                        'max_items' => 1,
                    ],
    
                    'post_mid' => [
                        'name' => 'Side Feature - Middle',
                        'bucketables' => [
                            [
                                'module' => 'posts',
                                'name' => 'Posts',
                                'scopes' => ['published' => true],
                            ],
                        ],
                        'max_items' => 1,
                    ],
    
                    'post_bot' => [
                        'name' => 'Side Feature - Bottom',
                        'bucketables' => [
                            [
                                'module' => 'posts',
                                'name' => 'Posts',
                                'scopes' => ['published' => true],
                            ],
                        ],
                        'max_items' => 1,
                    ],
                ],
            ],
        ],
  • u

    user

    07/06/2021, 2:49 PM
    The page looks like my expectations 😄
  • i

    ifox

    07/06/2021, 2:51 PM
    you could also query all buckets in a single query:
    Feature::whereIn('bucket_name', ['post_feature', 'post_top', 'post_mid', 'post_bot'])->get()
  • i

    ifox

    07/06/2021, 2:51 PM
    then you'd get a collection where each item will have a
    featured
    relationship giving you access to the posts
  • u

    user

    07/06/2021, 2:52 PM
    Aaah I see
  • u

    user

    07/06/2021, 2:52 PM
    Thanks
  • p

    pboivin

    07/06/2021, 2:55 PM
    Haven't measured it extensively (if at all) but from my experience, there's no significant performance penalty if your tables are indexed properly. For example,
    related
    is indexed by
    browser_name
    . I don't even think there's any real overhead on the Laravel side because the fully qualified model is stored in the DB.
  • u

    user

    07/06/2021, 2:55 PM
    Thanks for the information
  • i

    ifox

    07/06/2021, 2:57 PM
    something that's mentioned in the buckets documentation that is actually a recommendation overall is to setup morph maps for your Twill models
  • i

    ifox

    07/06/2021, 2:58 PM
    https://laravel.com/docs/8.x/eloquent-relationships#custom-polymorphic-types
  • i

    ifox

    07/06/2021, 2:59 PM
    this does 2 things: you can change namespace without having to modify your database records, and it helps Twill for some features like search or buckets
  • v

    void

    07/06/2021, 3:06 PM
    I'm running in blocks not rendering issue with Twill 2.0 this is working in production it shows a text field on each block I digged the GH Issues and went on the docs to see the proper workflow for generating blocks in case I missed a step https://twill.io/docs/#development-workflow I possibly found a typo: "As of verison 2.2, it is not necessary to rebuild Twill's frontend when working with blocks anymore. Their templates are now dynamically rendered in Blade and loaded at runtime by Vue. (For <2.1.x users, it means you do not need to run php artisan twill:blocks and npm run twill-build" So me a < 2.1 user need or not to run npm run twill-build? either way from the laravels root folder I get missing script twill-build (maybe I have to go to twill's root)
  • v

    void

    07/06/2021, 3:08 PM
    verison is typoed too in that quoted text
  • p

    pboivin

    07/06/2021, 3:08 PM
    You're right, I don't think
    npm run twill-build
    is right
  • p

    pboivin

    07/06/2021, 3:09 PM
    It would be
    php artisan twill:build
  • v

    void

    07/06/2021, 3:09 PM
    and if something is as of version 2.2 then users > 2.1 do not need
  • i

    ifox

    07/06/2021, 3:09 PM
    the no-build workflow is available since 2.0: https://github.com/area17/twill/blob/2.x/CHANGELOG.md#blocks-and-frontend-build-workflow
  • i

    ifox

    07/06/2021, 3:09 PM
    if you use custom Vue blocks, you still need to build
  • v

    void

    07/06/2021, 3:10 PM
    Thank you both I don't mean to suck dry your time No our block aren't custom as far as I can tell.
  • p

    pboivin

    07/06/2021, 3:14 PM
    No worries 🙂 So, on Twill 2.0 you could simply create your blocks as single Blade files under
    views/admin/blocks
  • i

    ifox

    07/06/2021, 3:14 PM
    did you try running
    php artisan twill:update
    ?
  • v

    void

    07/06/2021, 3:16 PM
    php artisan twill:build worked for me
  • i

    ifox

    07/06/2021, 3:16 PM
    no this is a repeater, not custom
  • v

    void

    07/06/2021, 3:17 PM
    hmm. kinda puzzled now about the inner workings then but I'm still learning it maybe one day I can contribute a PR to pay you back guys 🙂
  • v

    void

    07/06/2021, 3:18 PM
    for now I will just keep in mind that twill build may solve blocks not rendering issue.
  • p

    pboivin

    07/06/2021, 3:23 PM
    Yeah, there's some overlap conceptually (and visually) between blocks/repeaters/browsers... I get the confusion. Don't hesitate to suggest some updates to the docs, that would be more than welcome!
  • v

    void

    07/06/2021, 3:25 PM
    My confusion was mostly on the part that I use 2.0 and I still had to twill build to get those to render
  • v

    void

    07/06/2021, 3:26 PM
    but sure now I'm heads down on docs on my free time so I will try to Pr typos or suggestions if I track any
  • u

    user

    07/06/2021, 3:38 PM
    How to properly select a post based of a slug? and why is this not clearly found in the docs? I search on slug and slugs. And I might read over it but I cannot find it
  • i

    ifox

    07/06/2021, 3:39 PM
    @User for clarity, I think
    twill:update
    would have solved it for you
1...474849...484Latest