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

    ckmirafss

    06/09/2022, 6:53 AM
    So I followed the Repeater docs. Am I missing something?
  • c

    ckmirafss

    06/09/2022, 6:58 AM
    I also added
    @twillRepeaterComponent('services')
    but sill component on null
  • h

    Harings Rob

    06/09/2022, 7:11 AM
    Does not look like you missed anything. You are on twill 2.8?
  • h

    Harings Rob

    06/09/2022, 7:12 AM
    just to be safe can you try
    php artisan view:clear
    and
    php artisan cache:clear
  • m

    mateoD

    06/09/2022, 7:23 AM
    i have this code how can i make it works where i dont have any image, what value do i pass $image= ?
  • h

    Harings Rob

    06/09/2022, 7:25 AM
    I personally would wrap it like this:
    Copy code
    @isset($image)
      {!! Twillimage... !!}}
    @endisset
  • m

    mateoD

    06/09/2022, 7:30 AM
    i try this but if i dont have image displays Attempt to read property "width" on null @Harings Rob
  • h

    Harings Rob

    06/09/2022, 7:30 AM
    What is the output of @dd($image) right before the twillImage::render?
  • h

    Harings Rob

    06/09/2022, 7:31 AM
    Can you show again the code after you changed it with the isset?
  • h

    Harings Rob

    06/09/2022, 7:35 AM
    I don't understand how you can have an image without an image 😄
  • m

    mateoD

    06/09/2022, 7:35 AM
    i want to display the view with out image
  • m

    mateoD

    06/09/2022, 7:36 AM
    becouse sometimes i have image in comonent sometimes no
  • h

    Harings Rob

    06/09/2022, 7:37 AM
    I get that, I am just confused that even if there is no image, it still manages to give you an image object.
  • h

    Harings Rob

    06/09/2022, 7:37 AM
    Can you try @isset($image->exists()) ?
  • m

    mateoD

    06/09/2022, 7:40 AM
    it doesnt work displays Cannot use isset() on the result of an expression (you can use "null !== expression" instead)
  • h

    Harings Rob

    06/09/2022, 7:40 AM
    sorry.
    @if($image->exists())
  • m

    mateoD

    06/09/2022, 7:41 AM
    Call to undefined method A17\Twill\Image\Models\Image::exists()
  • h

    Harings Rob

    06/09/2022, 7:43 AM
    Ah this is not a model..
  • k

    kalle

    06/09/2022, 7:43 AM
    You can set
    width
    on render eg from Git repo
    Copy code
    <div class="w-1/4">
        {!! TwillImage::render($previewImage, [
            'width' => 700,
        ]) !!}
    </div>
  • k

    kalle

    06/09/2022, 7:44 AM
    But default value should be 1000, idk why is throwing an error there.
  • h

    Harings Rob

    06/09/2022, 7:44 AM
    I think it is a different issue @kalle, there is no image at all.
  • k

    kalle

    06/09/2022, 7:45 AM
    Im refering to this, but yeah it fails bcs TwillImage was not setuped correctly / has missing assets.
  • i

    ifox

    06/09/2022, 8:03 AM
    @mateoD did you try
    if ($block->hasImage('image'))
  • k

    kalle

    06/09/2022, 8:03 AM
    Idk only solution I see is to check if block has that specific image with
    $block->hasImage('image')
    before rendering or init
  • m

    mateoD

    06/09/2022, 8:04 AM
    yes i try it but it works if i have one image
  • i

    ifox

    06/09/2022, 8:05 AM
    "i try it but it works" hmm not following you
  • k

    kalle

    06/09/2022, 8:05 AM
    But in which case it fails if its multiple images or none?
  • m

    mateoD

    06/09/2022, 8:07 AM
    it fails if i dont put an image on a block that has a media input
  • m

    mateoD

    06/09/2022, 8:07 AM
    when i put the image it works as it should
  • m

    mateoD

    06/09/2022, 8:08 AM
    i cant find how to handle it with a condition
1...340341342...484Latest