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

    chrisdarling

    06/29/2021, 11:40 AM
    Spoke too soon, now have 'Your submission could not be processed.' when saving
  • i

    ifox

    06/29/2021, 11:41 AM
    ok so let's check what you have in the repository
  • i

    ifox

    06/29/2021, 11:41 AM
    and check the actual error in console or logs
  • c

    chrisdarling

    06/29/2021, 11:42 AM
    Copy code
    class QuoteRepository extends ModuleRepository
    {
        use HandleMedias, HandleFiles, HandleRevisions, HandleRepeaters;
    
        public function __construct(Quote $model)
        {
            $this->model = $model;
        }
    
        public function afterSave($object, $fields)
        {
            $this->updateRepeater($object, $fields, 'quoteoptions', 'QuoteOption');
            parent::afterSave($object, $fields);
        }
    
        public function getFormFields($object)
        {
            $fields = parent::getFormFields($object);
            $fields = $this->getFormFieldsForRepeater($object, $fields, 'quoteoptions', 'QuoteOption');
            return $fields;
        }
    }
  • c

    chrisdarling

    06/29/2021, 11:44 AM
    logs
  • c

    chrisdarling

    06/29/2021, 11:45 AM
    Do I need to have any code in the
    QuoteOptionRepository
    class?
  • i

    ifox

    06/29/2021, 11:48 AM
    you only need code there if the form needs it (if it uses a browser field itself for example)
  • i

    ifox

    06/29/2021, 11:50 AM
    try removing HandleRevisions from QuoteOptionRepository if it's there
  • i

    ifox

    06/29/2021, 11:52 AM
    assuming QuoteOption doesn't use HasRevisions
  • c

    chrisdarling

    06/29/2021, 12:08 PM
    Nailed it, thanks again.
  • c

    chrisdarling

    06/29/2021, 12:10 PM
    Is it permitted/possible to use Revisions on models managed by Repeater/Browser?
  • i

    ifox

    06/29/2021, 12:14 PM
    yes
  • i

    ifox

    06/29/2021, 12:15 PM
    as long as you setup the module associated to support revisions
  • c

    chrisdarling

    06/29/2021, 12:42 PM
    Seem to be experiencing a bug with Repeater. If I add a new record and save the parent record I see it gets added to the database. Now without refreshing the page, if I click save again (on the parent record - quote in my example) then I end up with 2x the newly added record when I refresh the page.
  • p

    pboivin

    06/29/2021, 1:12 PM
    Hey @User , I can confirm this bug... sort of 🙂 Following your steps, I can see the duplicate records created in the DB but when I refresh the page, my repeater still has only one item in it. I'll keep testing!
  • i

    ifox

    06/29/2021, 1:15 PM
    one of them should be soft-deleted, right?
  • c

    chrisdarling

    06/29/2021, 1:17 PM
    @ifox there are two records but one doess have a value in deleted_at column
  • p

    pboivin

    06/29/2021, 1:17 PM
    Ah, yes! All soft-deleted but the most recent item.
  • d

    Dmi3yy

    06/29/2021, 1:17 PM
    Hi have small bug with slugs in db: https://tppr.me/qYDma we see 2 slug one is active in hendle Slug i see if we get old slug need redirect to new one: https://tppr.me/7eOK1 but i try this and work 2 slugs without redirect old to new (
  • c

    chrisdarling

    06/29/2021, 1:18 PM
    So how are soft-deleted records excluded? is this something I need to setup because both are showing right now
  • i

    ifox

    06/29/2021, 1:20 PM
    oh, @chrisdarling, it sounds like your QuoteOption model doesn't inherit from Twill's base model
  • i

    ifox

    06/29/2021, 1:20 PM
    otherwise it would be soft delete aware
  • c

    chrisdarling

    06/29/2021, 1:21 PM
    ah, perhaps, I had setup this model using artisan make before (I thought Ih ad to as i wasn't using a controller to manage it)... that's probably it!
  • i

    ifox

    06/29/2021, 1:22 PM
    You would need to check that redirect property in your controller to know if it needs to be done
  • c

    chrisdarling

    06/29/2021, 1:22 PM
    that has indeed fixed it
  • i

    ifox

    06/29/2021, 1:22 PM
    makes sense yeah, it can be easier to just setup a full module but not enable its routes
  • c

    chrisdarling

    06/29/2021, 1:23 PM
    New question 😄 how do I go about adding new actions? For example, I want to add a duplicate button, or a 'Print as PDF' button
  • d

    Dmi3yy

    06/29/2021, 1:23 PM
    Thanks, understand
  • i

    ifox

    06/29/2021, 1:23 PM
    dang I can't wait for Discord threads (they are coming!)
  • i

    ifox

    06/29/2021, 1:24 PM
    on the index or form?
1...363738...484Latest