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

    kalle

    09/29/2022, 10:30 PM
    Yup.
  • c

    ckmirafss

    09/29/2022, 10:32 PM
    is there a link sir, so I can check. thank youuuu
  • i

    ifox

    09/29/2022, 10:32 PM
    Copy code
    php
    public function setPasswordAttribute($value){
      $this->attributes['password'] = Hash::make($value);
    }
  • i

    ifox

    09/29/2022, 10:32 PM
    https://laracasts.com/series/laravel-8-from-scratch/episodes/46
  • c

    ckmirafss

    09/29/2022, 10:33 PM
    i just put this on model right?
  • k

    kalle

    09/29/2022, 10:34 PM
    Or with a Repo
    Copy code
    php
    public function prepareFieldsBeforeSave($object, $fields) 
    {
        $fields['password'] = Hash::make($fields['password']);
        return parent::prepareFieldsBeforeSave($object, $fields);
    }
  • i

    ifox

    09/29/2022, 10:34 PM
    I think you should go with @kalle approach, and that would be in your module's repository class
  • c

    ckmirafss

    09/29/2022, 10:35 PM
    i tried both sir, it worked.
  • i

    ifox

    09/29/2022, 10:35 PM
    then I guess you probably don't want to show the hash in the form field once it's saved
  • i

    ifox

    09/29/2022, 10:36 PM
    you could use
    getFormFields
    for that, or a condition in your blade form to not show the field
  • c

    ckmirafss

    09/29/2022, 10:36 PM
    Yes sir
  • a

    afatmustafa

    09/30/2022, 6:24 AM
    I solved the problem last night, rappasoft/laravel-authentication-log is installed but trait is not used in Twill User Model, that's why it gives the error.
  • k

    Kormi

    09/30/2022, 11:14 AM
    Hi
  • k

    Kormi

    09/30/2022, 11:17 AM
    Hi, When I use Repeater Fields (in this case to create a menu) when I save all is good. In frontend if I try to get data is in the correct order. But When I Refresh admin page the order change (by creation date). How can I solve this? This is my code
    Copy code
    @twillRepeaterTitle('Menu Item')
    @twillRepeaterTitleField('title', ['hidePrefix' => false])
    @twillRepeaterGroup('twill')
    
    @formField('radios', [
    'label' => 'Link Type',
    'name' => 'destination',
    'inline' => true,
    'options' => [
    [
    'value' => 'internal',
    'label' => 'Internal'
    ],
    ]
    ])
    
    @formField('input', [
    'name' => 'title',
    'label' => 'Title',
    'translated' => true,
    ])
    
    {{-- Show Browser field to select internal item --}}
    <x-formConnectedFields fieldName="destination" fieldValues="internal" renderForBlocks="true" keepAlive="false">
        @formField('browser', [
        'label' => 'Link',
        'max' => 1,
        'name' => 'linkables',
        'modules' => [
        [
        'label' => __('site.page.plural'),
        'name' => 'pages.pages',
        ],
        ])
    </x-formConnectedFields>
    
    {{-- Show text field to enter url if an external link is selected --}}
    <x-formConnectedFields fieldName="destination" fieldValues="external" renderForBlocks="true" keepAlive="false">
        @formField('input', [
        'name' => 'url',
        'label' => 'Url',
        'translated' => true,
        ])
    </x-formConnectedFields>
    <x-formConnectedFields fieldName="destination" fieldValues="model" renderForBlocks="true" keepAlive="false">
        @formField('select', [
        'name' => 'model',
        'label' => 'Model',
        'default' => 'App\Models\Technology',
        'options' => [
        [
        'value' => 'App\Models\Technology',
        'label' => 'Technology'
        ],
    </x-formConnectedFields>
  • k

    Kormi

    09/30/2022, 11:18 AM
    In this case I put the menu Item "Ciao" in position 2... But when i refresh the admin page it is in the last position
  • k

    Kormi

    09/30/2022, 11:20 AM
    In frontend all is ok!
  • k

    Kormi

    09/30/2022, 11:22 AM
    I save this config.... frontend is GOOD..
  • k

    Kormi

    09/30/2022, 11:22 AM
    But if I refresh admin page...repeaters order change
  • i

    ifox

    09/30/2022, 11:29 AM
    Do you have a position column in your menu_items table that is used as orderBy in the eloquent relationship for your repeater?
  • t

    tfilos

    09/30/2022, 1:12 PM
    Great, so this is it: https://glide.thephpleague.com/2.0/api/encode/#format-fm
  • i

    ifox

    09/30/2022, 1:13 PM
    you might want to check #873445927740903475 https://github.com/area17/twill-image > Twill Image is a package designed to work with Twill to display responsive images easily on your site. It leverages Twill's image processing capabilities and adds modern lazy-loading techniques. It supports responsive images, art direction and fixed width images. > > - with multiple elements > - Twill's low-quality placeholder (LQIP) > - Background-color placeholder > - Art direction (multiple crops) > - WebP and JPEG support > - Lazy load (fade in) image with IntersectionOserver > - Support native lazy loading with loading='lazy'
  • k

    Kormi

    09/30/2022, 1:24 PM
    yes
    i
    h
    • 3
    • 17
  • t

    tfilos

    09/30/2022, 2:01 PM
    Oh cool! I rigged up a thing with img srcset but this sounds nicer
  • t

    tfilos

    09/30/2022, 2:04 PM
    Even with the lazy loading! I implemented all of these separately... would be nice to simplify
  • h

    Hip-Hop

    10/03/2022, 4:53 AM
    Good afternoon! Please tell me the solution to the following question (where can I read it?). I have a module where I create posts (for example, Articles), and in another module I want to insert them into blocks (integrate, if I may say so)? Ie add as many blocks as I have entries. If for example I have 3 article entries, then create 3 blocks
    h
    • 2
    • 3
  • h

    Harings Rob

    10/03/2022, 6:35 AM
    Good afternoon Please tell me the
  • j

    jefsev

    10/03/2022, 8:04 AM
    He 🙂
  • j

    jefsev

    10/03/2022, 8:05 AM
    Loving Twill. I have a question, is there an simple way to use the Twill users on the frontend, I need to hide pages which are only visible for users registered in the Twill cms.
  • h

    Harings Rob

    10/03/2022, 8:49 AM
    hey @jefsev if your frontend is sharing the session, then you can check Auth('twill_users') I believe.
  • h

    Harings Rob

    10/03/2022, 8:49 AM
    Auth::guard('twill_users')
1...410411412...484Latest