dimanche 3 décembre 2017

how to display comments relavent on each task in Laravel 5.2

I am developing project management application using Laravel 5.2. and in My application user can create different projects and one project have multiple tasks. one task may be multiple comments. currently in My app is displaying comments witch are related to each project. (comments displaying for each project not for each task )

see My comments displaying view file.

@foreach ($task->project->comments as $comment)
        <div>
                    <div><i class="fa fa-check-square-o"></i>
                    <span> by
                       <span style="font-style: italic;color: #09f;">
                        
                       </span>
                    </span></div>
                    <a href="/projects//comments//edit">Edit</a>
                    <button class="btn btn-danger delete pull-right"
                      data-action="/projects//comments/"
                      data-token="">
                    <i class="fa fa-trash-o"></i>Delete
                    </button>
                </div>
                <hr/>
@endforeach

I have task id on each comment in My comment table

id    comments    project_id    task_id
 1       jgh          1            1
 2       jgh          2            2
 3       jdj          1            3

now I need displaying comments on each task. how can I do this?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire