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

    Harings Rob

    09/19/2022, 8:07 AM
    Hi i ve just updated from version 2 8 to
  • m

    mateoD

    09/19/2022, 2:01 PM
    hello everyone im trying to render medias in blade , can you help me how to do that
  • m

    mateoD

    09/19/2022, 2:11 PM
    i fixed it
  • t

    thingasd

    09/20/2022, 4:21 AM
    Hey guys, I can still login using the disabled user's credential. How can I prevent the disabled user login entirely?
  • k

    kalle

    09/20/2022, 7:50 AM
    Disabled in what way? You can always use Middleware for that usage.
  • t

    thingasd

    09/20/2022, 7:52 AM
    I think the disabled user should not be able to login instead of login without any permission
  • k

    kalle

    09/20/2022, 7:54 AM
    U mean per this? Yeah I checked and user can login again with disabled account. But still with middleware you can make this check.
  • h

    Harings Rob

    09/20/2022, 7:57 AM
    I think we should avoid that a user can login if disabled @ifox
  • h

    Hip-Hop

    09/20/2022, 10:57 AM
    Good afternoon! Can you help me with one issue? I have a block, for example with a text field and an image. I want to use this block in different places and with different styles. Can this be done somehow? Or do I have to create a similar block to add other styles?
  • i

    ifox

    09/20/2022, 11:01 AM
    @Hip-Hop there are multiple approaches to this. You could have a css class on the element wrapping your blocks for example, to give them different styles depending on the template. Another way is to pass data to the renderBlocks function or using a Block class, to dynamically render the block differently depending on the data being passed by the template rendering these blocks. Hope that helps!
  • z

    zynth

    09/20/2022, 2:04 PM
    Hello guys, I want to dynamically render my homepages navbar items based on the blocks that are being used on my singleton modules block editor. It uses custom blocks that have a title attribute which i want to use as the navbar items text and anchor. How would I approach this?
  • h

    Harings Rob

    09/20/2022, 2:10 PM
    @zynth Twill 2 or 3? What you could do in any case is in your homepage controller you could get the blocks of the current page and parse those ($model->blocks())
  • z

    zynth

    09/20/2022, 2:10 PM
    Hey, Twill 3 😄
  • h

    Harings Rob

    09/20/2022, 2:10 PM
    (does not change my answer lol, dont know why I asked) 😄
  • z

    zynth

    09/20/2022, 2:10 PM
    lmao
  • z

    zynth

    09/20/2022, 2:14 PM
    You mean this?
  • h

    Harings Rob

    09/20/2022, 2:15 PM
    yes, but you can filter them on type or even json https://laravel.com/docs/9.x/queries#json-where-clauses
  • h

    Harings Rob

    09/20/2022, 2:16 PM
    And then you can use the regular ->input or ->translatedInput on them to build your menu.
  • z

    zynth

    09/20/2022, 2:17 PM
    I see, I'll give it a try. If I need any help I'll ask you guys again, if you don't mind. 😄
  • z

    zynth

    09/20/2022, 2:59 PM
    When I dump
    $this->model->blocks
    in my HomepageRepository I'm getting a empty collection.
  • z

    zynth

    09/20/2022, 3:00 PM
    Shouldn't I get all the Blocks that have been used on my Homepage module? I don't understand this. 😄
  • h

    Harings Rob

    09/20/2022, 3:01 PM
    How about
    $this->model->blocks()->get()
  • z

    zynth

    09/20/2022, 3:03 PM
    Same result
  • h

    Harings Rob

    09/20/2022, 3:04 PM
    Does your current model have blocks?
  • h

    Harings Rob

    09/20/2022, 3:04 PM
    $this->model->id gives your an id?
  • z

    zynth

    09/20/2022, 3:05 PM
    It returns null? But it's the only module I use. Wait maybe it has to do something with revisions?
  • h

    Harings Rob

    09/20/2022, 3:06 PM
    Well, I cannot really help you much out of the box since there's no build in frontend in Twill. But on your route controller for you homepage you need to, I guess, fetch your model.
  • h

    Harings Rob

    09/20/2022, 3:07 PM
    Copy code
    php
    Route::get('/blogs/{slug}', static function (string $blogSlug) {
        $blog = app(BlogRepository::class)->forSlug($blogSlug);
        if (!$blog || !$blog->published()) {
            abort(404);
        }
        return view('site.blog', ['item' => $blog]);
    })->name('blog.detail');
    This is from the blog example
  • z

    zynth

    09/20/2022, 3:11 PM
    Hmm this doesn't quite help me now, but I'm gonna need this in the future 😄
  • h

    Harings Rob

    09/20/2022, 3:12 PM
    Are you working with a singleton?
1...399400401...484Latest