Assign value when creating item (create view)



  • I am particularly new to programming and laravel, so stuck at something.

    I have created package module which creates package and clients module which creates clients.

    I have created few packages, now I want to assign them when I am creating a client.

    What I want is when creating client (Create view) I need a dropdown from package table (It is present in db). How to achieve this?



  • Hi,

    Did you check the docs and the select macro ?

    https://asgardcms.com/docs/v2/core-module/form-macros#translatable-select

    Create

    {!! Form::i18nSelect('test', ‘test’, $errors, $lang, [1,2,3]) !!}
    

    Edit

    {!! Form::i18nSelect(‘test’, ‘test’, $errors, $lang, [1,2,3], $object) !!} // Edit view
    

    And the array [1,2,3] is your value, don't forget to query those value and to pass it to your view



  • Hey Thanks for reply. Yes I already played with it. But I am basically new to programming. I don't know properly how to have database query instead of [1, 2, 3]..

    how to query those value and to pass it to your view?


Log in to reply