Questions Laravel වැඩ්ඩොන්ගෙන් පොඩි උදව්වක් ඕනා.

thriloka

Well-known member
  • Apr 28, 2022
    890
    970
    93
    මචන් මම Laravel 8 පාවිච්චි කරල web app එකක් හදනවා. ඒකෙ pop up box එකක් ඕපන් වෙලා selection box එකක් ඇතුලෙ options කිහිපයක් තියේ, ඒ options populate වෙන්නෙත් database එකකින්. මට ඕන එක එක option එක select කරනකොට popup එකේම table එකක ඒ option එකේ key එකට අදාලව database එකේ තියන fields ටිකක් පෙන්නන්න page එක reload නොවී.

    මේ තියෙන්නෙ selection box එකේ කෝඩ් එක. වෙන controller function එකක වගේ කෝඩ් කොටසක් ඕනනම් කියන්න මම thread එක update කරන්නම්.

    PHP:
    <div id="UpgradeStudentModal" class="modal fade" tabindex="-1" aria-labelledby="myModalLabel"
         aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title mt-0" id="myModalLabel">Upgrade Student</h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal"
                            aria-label="Close"></button>
                </div>
                <div class="modal-body">
                    <form action="" method="post" enctype="multipart/form-data">
                        {{csrf_field()}}
    
                        <div class="mb-3">
                            <label for="" class="form-label">Teacher</label>
                            <select class="form-control" name="teacherId">
                                @foreach($teachers as $teacher)
                                    <option value="{{$teacher->tId}}">{{$teacher->tName}}</option>
                                @endforeach
                            </select>
                        </div>
    
                        <div class="modal-footer">
                            <button type="submit" class="btn btn-primary waves-effect waves-light">Save
                            </button>
                            <button type="button" class="btn btn-outline-danger waves-effect waves-light"
                                    data-bs-dismiss="modal">Close
                            </button>
    
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>

    popup එකේ screenshot එකක් තමයි පහළ තියෙන්නෙ.

    Mxtdn.png


    dynamically populate වෙන්න ඕන මේ විදිහට, test data ටිකක් තියෙන්නෙ

    VEvMs.png


    ලොකු උදව්වක් guys ගොඩ දාගන්න හෙල්ප් එකක් දුන්නොත්ත්. 👊
     

    thriloka

    Well-known member
  • Apr 28, 2022
    890
    970
    93
    Use vuejs or livewire
    ඒව නැතුව බැරිද මචන්. ආය front-end වෙනස් කරන්න අමාරුයි.

    Bump.
    රෑ වෙලා නම් හෙල්ප් එකක් දෙන්න්ම්. දැන් පාරේ ඉන්නේ
    තෑන්ක්ස් මචන්.
    ------ Post added on Jun 11, 2022 at 6:28 PM
     
    • Like
    Reactions: B.Chat

    stasia

    Well-known member
  • May 28, 2018
    12,813
    26,352
    113
    כדור הארץ
    ඒව නැතුව බැරිද මචන්. ආය front-end වෙනස් කරන්න අමාරුයි.
    Vanilla js වලිනුත් පුළුවන්. jquery වලින් වත් බලපන්. Php වලින් විතරක්ම නම් ඕක කරන්න බෑ. Selected option එක php වලින් detect කරගන්න බෑ හොඳටම කරන්න පුළුවන් vue js නම්. Interactive site එකක් හදන්න js library එකක් ඕනිමයි.
     
    • Like
    Reactions: thriloka

    thriloka

    Well-known member
  • Apr 28, 2022
    890
    970
    93
    Vanilla js වලිනුත් පුළුවන්. jquery වලින් වත් බලපන්. Php වලින් විතරක්ම නම් ඕක කරන්න බෑ. Selected option එක php වලින් detect කරගන්න බෑ හොඳටම කරන්න පුළුවන් vue js නම්. Interactive site එකක් හදන්න js library එකක් ඕනිමයි.
    ඔව් jquery ඕන වෙනවනම් තමා. කරන හැටි තමා තේරෙන්නෙ නැත්තෙ. බලමුකො.
     

    stasia

    Well-known member
  • May 28, 2018
    12,813
    26,352
    113
    כדור הארץ
    මචන් මම Laravel 8 පාවිච්චි කරල web app එකක් හදනවා. ඒකෙ pop up box එකක් ඕපන් වෙලා selection box එකක් ඇතුලෙ options කිහිපයක් තියේ, ඒ options populate වෙන්නෙත් database එකකින්. මට ඕන එක එක option එක select කරනකොට popup එකේම table එකක ඒ option එකේ key එකට අදාලව database එකේ තියන fields ටිකක් පෙන්නන්න page එක reload නොවී.

    මේ තියෙන්නෙ selection box එකේ කෝඩ් එක. වෙන controller function එකක වගේ කෝඩ් කොටසක් ඕනනම් කියන්න මම thread එක update කරන්නම්.

    PHP:
    <div id="UpgradeStudentModal" class="modal fade" tabindex="-1" aria-labelledby="myModalLabel"
         aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title mt-0" id="myModalLabel">Upgrade Student</h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal"
                            aria-label="Close"></button>
                </div>
                <div class="modal-body">
                    <form action="" method="post" enctype="multipart/form-data">
                        {{csrf_field()}}
    
                        <div class="mb-3">
                            <label for="" class="form-label">Teacher</label>
                            <select class="form-control" name="teacherId">
                                @foreach($teachers as $teacher)
                                    <option value="{{$teacher->tId}}">{{$teacher->tName}}</option>
                                @endforeach
                            </select>
                        </div>
    
                        <div class="modal-footer">
                            <button type="submit" class="btn btn-primary waves-effect waves-light">Save
                            </button>
                            <button type="button" class="btn btn-outline-danger waves-effect waves-light"
                                    data-bs-dismiss="modal">Close
                            </button>
    
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>

    popup එකේ screenshot එකක් තමයි පහළ තියෙන්නෙ.

    Mxtdn.png


    dynamically populate වෙන්න ඕන මේ විදිහට, test data ටිකක් තියෙන්නෙ

    VEvMs.png


    ලොකු උදව්වක් guys ගොඩ දාගන්න හෙල්ප් එකක් දුන්නොත්ත්. 👊
    puluwan nam help ekak ganin