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

    ifox

    06/10/2022, 7:09 PM
    @kalle in a block or outside?
  • k

    kalle

    06/10/2022, 10:25 PM
    @ifox Module
  • i

    ifox

    06/10/2022, 11:09 PM
    that's strange
  • i

    ifox

    06/10/2022, 11:10 PM
    are you doing any override in your module repository that would prevent traits from doing their job?
  • c

    ckmirafss

    06/10/2022, 11:21 PM
    Hi @Harings Rob , I already removed the block editor config. I think my only problem is on the Repository. I think there's something wrong with my afterSave and getFormField.
  • k

    kalle

    06/10/2022, 11:27 PM
    In this project currently no, this went live and this happens now. So unexpected. 😦 And yes it worked before. 😄
  • i

    ifox

    06/10/2022, 11:29 PM
    do you have a repeater file called
    service
    ?
  • c

    ckmirafss

    06/10/2022, 11:29 PM
    Yes
  • c

    ckmirafss

    06/10/2022, 11:29 PM
    I fixed it already the only problem as of the moment is when I add an another item an error occurred.
  • c

    ckmirafss

    06/10/2022, 11:30 PM
    Your submission could not be processed.
  • i

    ifox

    06/10/2022, 11:31 PM
    what does
    TwillBlocks::findRepeaterByName('service')
    returns in tinker?
  • c

    ckmirafss

    06/10/2022, 11:32 PM
    Here's the error from log
  • c

    ckmirafss

    06/10/2022, 11:33 PM
    But the who_we_are_id column is existing.
  • i

    ifox

    06/10/2022, 11:33 PM
    that's not what this error is saying, it's saying that the insert is not providing a value for that column
  • i

    ifox

    06/10/2022, 11:34 PM
    did you set it as fillable on the service model?
  • c

    ckmirafss

    06/10/2022, 11:34 PM
    So here's my code.
    service.blade.php
    Copy code
    @twillBlockTitle('Service')
    @twillBlockIcon('text')
    @twillRepeaterTrigger('Add Service')
    @twillBlockGroup('app')
    @formField('repeater', ['type' => 'service_item'])
    service_item.blade.php
    Copy code
    @twillRepeaterTitle('Service item')
      @twillRepeaterMax('10')
    
      @formField('input', [
      'name' => 'title',
      'label' => 'Title',
      'translated' => false,
      ])
    
      @formField('input', [
      'name' => 'description',
      'label' => 'Description',
      'translated' => false,
      ])
  • c

    ckmirafss

    06/10/2022, 11:35 PM
    for
    form.blade.php
    @formField('repeater', ['type' => 'service_item'])
  • c

    ckmirafss

    06/10/2022, 11:35 PM
    Whowearerepository.php
  • i

    ifox

    06/10/2022, 11:35 PM
    what about Service.php
  • c

    ckmirafss

    06/10/2022, 11:37 PM
    Damn it. Saw the error on Service.php
  • c

    ckmirafss

    06/10/2022, 11:37 PM
    the fillable was set to
    who_we_ares_id
    , it must
    who_we_are_id
  • c

    ckmirafss

    06/10/2022, 11:38 PM
    All good now. Thanks @ifox !!!
  • k

    kalle

    06/10/2022, 11:38 PM
    @ifox sorry man, my mistake. After deeply looking into code I forgot to call parent method of
    afterSave
    so file handler was never reached. 😄
  • c

    ckmirafss

    06/10/2022, 11:38 PM
    How do we usually call it on FE Side, @ifox ?
  • i

    ifox

    06/10/2022, 11:39 PM
    the repeater?
  • c

    ckmirafss

    06/10/2022, 11:39 PM
    yea the datas from the repeater
  • i

    ifox

    06/10/2022, 11:40 PM
    $whoWeAre->services and then it's a collection of service model so you can access their properties like a normal module
  • i

    ifox

    06/10/2022, 11:42 PM
    $whoWeAre->services->pluck('description', 'title') would get you something like
    Copy code
    [
      "service_title" => "service_description",
      "..." => "..."
    ]
  • i

    ifox

    06/10/2022, 11:43 PM
    just an example, you can do whatever you need
  • i

    ifox

    06/10/2022, 11:44 PM
    I see you called your relation singular so would be ->service in your case, but you get the idea
1...342343344...484Latest