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

    elkex

    12/08/2022, 12:21 PM
    Hm..
  • k

    kalle

    12/08/2022, 12:25 PM
    That is only data gathering for breadcrumbs, CMS frontend resolves the rendering. https://github.com/area17/twill/blob/a5b3ffc20ab7826bff6825f28982444e7272537d/views/partials/navigation/_breadcrumb.blade.php
  • d

    devtutorum

    12/08/2022, 2:03 PM
    How does Twill order items, on position or creation date?
  • i

    ifox

    12/08/2022, 2:06 PM
    creation date if your model is not using Sortable, position if it is
  • i

    ifox

    12/08/2022, 2:09 PM
    @elkex since your nested model is using https://github.com/lazychaser/laravel-nestedset, you can use all their helpers to build your breadcrumb for the frontend
  • e

    elkex

    12/08/2022, 2:09 PM
    Can I connect the profile module fields to my user model fields? I want to be able to change my user firstname and lastname or emailadres from the Twill backend.. Is that possible?
  • k

    kalle

    12/08/2022, 2:15 PM
    Im not sure that I follow you here. What is your user model in this case? If your are talking about editing frontend user in you module form, its possible.
  • e

    elkex

    12/08/2022, 2:16 PM
    Yes that's what I mean, do I have to add the same user fields to my profile model or is that not necessary?
  • k

    kalle

    12/08/2022, 2:18 PM
    Yes you need them in your custom model $fillables, so Twill can mass update those fields on your custom User model which you use for auth.
  • e

    elkex

    12/08/2022, 2:22 PM
    So I do need to add them to my profiles tables?
  • i

    ifox

    12/08/2022, 2:22 PM
    I feel like there's some confusion as to what the "profile" model is in our guide. The idea is to add data to the user model, not to modify the user model itself. If you want to directly update the user model, you should build a module on top of it, not use an additional profile model
  • i

    ifox

    12/08/2022, 2:23 PM
    but if you want to do that, you will need to update the default Laravel user model to be Twill-aware
  • i

    ifox

    12/08/2022, 2:24 PM
    which means it needs to extends Twill's model
  • i

    ifox

    12/08/2022, 2:24 PM
    from there you can create a twill repository and controller that point directly to the user model
  • e

    elkex

    12/08/2022, 2:26 PM
    Hm.. That sounds like a lot again.. What I could do is catch the afterSave values and update the User that is connected to the profile..? So I can have a bothways sync?
  • i

    ifox

    12/08/2022, 2:26 PM
    you can do that too, yes
  • e

    elkex

    12/08/2022, 2:26 PM
    Will probably be easier haha.. Only sucks I will have to store the data in 2 places..
  • i

    ifox

    12/08/2022, 2:26 PM
    you don't have to
  • i

    ifox

    12/08/2022, 2:27 PM
    you can unset the fields so that they don't need to be saved in profile, only in the user
  • e

    elkex

    12/08/2022, 2:27 PM
    How do I do that?
  • i

    ifox

    12/08/2022, 2:27 PM
    and from getFormFields, load them from the user
  • e

    elkex

    12/08/2022, 2:29 PM
    How do I do that..?
  • i

    ifox

    12/08/2022, 2:37 PM
    beforeSave should work
  • i

    ifox

    12/08/2022, 2:38 PM
    you would save the user there, and
    unset($fields['field_you_already_saved_in_user'])
    so that it doesnt try to save it in profile
  • i

    ifox

    12/08/2022, 2:39 PM
    In getFormFields you would get the associated user and set keys in $fields
  • e

    elkex

    12/08/2022, 2:43 PM
    You are confusing me.. You mean afterSave? How do I connect the user fields to the profile form?
  • e

    elkex

    12/08/2022, 2:43 PM
    In the docu it only mentions it for repeaters
  • e

    elkex

    12/08/2022, 2:44 PM
    and browsers.. Do I have to do it with a browser field?
  • i

    ifox

    12/08/2022, 2:58 PM
    No I mean beforeSave since you don't want to save user fields in your profile model. Your profile model, if you followed the guide, has a relationship with your user model, so on the profile form, you can use a field named like one of your user field, and use beforeSave of your profile repository to save those in the user model
  • e

    elkex

    12/08/2022, 3:16 PM
    And how do I get the values of those fields in my form?
1...435436437...484Latest