lundi 2 septembre 2019

How to track user id while submitting form through post method

I am making todolist web application.When user click on New Task modal pop up and when they submit their task how to track all user and their task by user id

I have created route(task.store) all the details of the user is stored in database but user_id is not stored

My Todolist New Task Create Event All Task

        </div>
        <span style="font-size:30px;cursor:pointer; padding-left:40px" onclick="openNav()">&#9776; open</span>
        <hr>
        <script>
            function openNav() {
                document.getElementById("mySidenav").style.width = "250px";
            }

            function closeNav() {
                document.getElementById("mySidenav").style.width = "0";
            }
        </script>
    </div>
    <div class = "col-9">
        @yield('content')
    </div>
    <div class="modal fade" id="myModal" role="dialog">
        <div class="modal-dialog">
            <!-- Modal content-->
            <div class="modal-content">
                <div class="modal-body">
                    <form action = "" method = "post">
                        @csrf
                        <div class = "form-group">
                            <label for="task">Task</label>
                            <input type ="text" name ="task" placeholder="I will complete" class = "form-control form-control-lg" id="task">
                        </div>
                        <div class = "form-group">
                            <label for="notes">
                                <textarea class = "form-control form-control-lg" id = "notes" name = "notes" rows = "8" cols = "30">Notes</textarea>
                            </label>
                        </div>
                        <h5>Remind Me</h5>
                        <div class = "form-check-inline">
                            <label class = "form-check-label">
                                <input type = "radio" class = "form-check-input form-check-input-lg" name="remind" value="today">Today
                            </label>
                        </div>
                        <div class = "form-check-inline">
                            <label class = "form-check-label">
                                <input type = "radio" class = "form-check-input form-check-input-lg" name="remind" value ="tomorrow">Tomorrow
                            </label>
                        </div>
                        <div class = "form-check-inline">
                            <label class = "form-check-label">
                                <input type = "radio" class = "form-check-input form-check-input-lg" name="remind" value="week">Week
                            </label>
                        </div>
                        <div class = "form-check-inline">
                            <label class = "form-check-label">
                                <input type = "radio" class = "form-check-input form-check-input-lg" name="remind" value="month">Month
                        </label>
                        </div>
                        <div class = "form-check-inline">
                            <label class = "form-check-label">
                                <input type = "radio" class = "form-check-input form-check-input-lg" name="remind" value ="someday" >Someday
                            </label>
                        </div>
                        <br>
                        <br>
                        priority
                        <h5>Priority</h5>
                        <div class = "form-check-inline">
                            <label class = "form-check-label">
                                <input type = "radio" class = "form-check-input form-check-input-lg" name="priority" value="high">High
                            </label>
                        </div>
                        <div class = "form-check-inline">
                            <label class = "form-check-label">
                                <input type = "radio" class = "form-check-input form-check-input-lg" name="priority" value="medium">Medium
                            </label>
                        </div>
                        <div class = "form-check-inline">
                            <label class = "form-check-label">
                                <input type = "radio" class = "form-check-input form-check-input-lg" name="priority" value="low">Low
                            </label>
                        </div>
                        <div class = "form-group">
                            <button type ="submit" class="btn btn-lg btn-success">Add Task</button>
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button class="btn btn-default" data-dismiss="modal">Close</button>
                </div>
            </div>
        </div>
    </div>
</div>

When user fill their New Task it should be saved according to the user_id.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire