php - how to show comment table data in Laravel 5.2 -


i developing project management app in laravel. in app 1 project have many tasks , 1 task have comment box users. developing comments post file , saving comments comment table. comment/form.blade.php

<div class="row" style="margin-left:5px;padding:5px;">     @if(isset($comments))            @foreach( $comments $comment)                 <div>                     <div><i class="fa fa-check-square-o"></i>                     <span>{{ $comment->comments }}                        <span style="font-style: italic;color: #09f;">                        {{ ($comment->user()->first()->username === auth()->user()->username) ? 'you' : $comment->user()->first()->username }}                         </span>                     </span></div>                     <a href="/projects/{{ $project->id }}/comments/{{ $comment->id }}/edit">edit</a>                     <button class="btn btn-danger delete pull-right"                       data-action="/projects/{{ $project->id }}/comments/{{ $comment->id }}"                       data-token="{{csrf_token()}}">                     <i class="fa fa-trash-o"></i>delete                     </button>                 </div>                 <hr/>             @endforeach     @endif      <form class="form-vertical" role="form" method="post" action="{{ route('projects.comments.create', $tasks->project->id) }}">         <div class="form-group{{ $errors->has('comments') ? ' has-error' : '' }}">             <textarea name="comments" class="form-control" style="width:80%;" id="comment" rows="5" cols="5"></textarea>             @if ($errors->has('comments'))                 <span class="help-block">{{ $errors->first('comments') }}</span>             @endif         </div>          <div class="form-group">             <button type="submit" class="btn btn-info">add comment</button>         </div>         <input type="hidden" name="_token" value="{{ csrf_token() }}">     </form> </div>   

i have include above blade file show.blade.php file in tasks folder in view file task/show.blade.php

<h2>{{ $tasks->project->project_name }}</h2> <hr> {{$tasks->task_name}} <hr> {!!$tasks->body!!} <hr> @include('comments.form') 

now need show comment table data on each project........... how can this? have following function , shoud put them?

 public function gettasks($id)     {         $tasks =  task::project($id)->get();         return $tasks;     } 


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -