lundi 11 septembre 2017

how to show comments table data in Laravel 5.2

In My laravel project management app. I have tasks to each project. when I select each project I can see project related tasks and when I click on each task I need show comments which related to task. this is commentController

 public function postNewComment(Request $request, $id, Comment $comment)
    {
       $this->validate($request, [
            'comments'     => 'required|min:5',
        ]);

       $comment->comments       = $request->input('comments');
       $comment->project_id     = $id;
       $comment->user_id        = Auth::user()->id;
       $comment->save();

       return redirect()->back()->with('info', 'Comment posted successfully');
    }

I have included comment form with show.blade.php in tasks folder in view file, tasks/form.blade.php

<h2></h2>
<hr>


<hr>

{!!$tasks->body!!}

<hr>

@include('comments.form')

My comments are saved in comment table and now I need show comments on each tasks to each project. how can I show this?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire