Skip to content

Commit

Permalink
Comment Table field change---comment to message
Browse files Browse the repository at this point in the history
  • Loading branch information
subhadipghorui committed Oct 16, 2020
1 parent 7b8d8a8 commit e976fb2
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions app/Http/Controllers/CommentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ class CommentController extends Controller
{
public function store(Request $request, $post)
{
$this->validate($request, ['comment' => 'required|max:1000']);
$this->validate($request, ['message' => 'required|max:1000']); //change comment field to message
$comment = new Comment();
$comment->post_id = $post;
$comment->user_id = Auth::id();
$comment->comment = $request->comment;
$comment->message = $request->message; //change comment field to message
$comment->save();

// Success message
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function up()
$table->id();
$table->unsignedBigInteger('post_id');
$table->unsignedBigInteger('user_id');
$table->text('comment');
$table->text('message');
$table->timestamps();
});
}
Expand Down
2 changes: 1 addition & 1 deletion resources/views/admin/comments/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
@foreach ($comments as $key => $comment)
<tr>
<td>{{$key+1}}</td>
<td>{{$comment->comment}}</td>
<td>{{$comment->message}}</td>
<td>{{$comment->user->name}}</td>
<td><a href="{{route('post',$comment->post->slug)}}">{{$comment->post->title}}</a></td>
<td>{{$comment->created_at->diffForHumans()}}</td>
Expand Down
2 changes: 1 addition & 1 deletion resources/views/admin/reply-comments/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
<tr>
<td>{{$key+1}}</td>
<td>{{$reply_comment->message}}</td>
<td>{{$reply_comment->comment->comment}}</td>
<td>{{$reply_comment->comment->message}}</td>
<td>{{$reply_comment->user->name}}</td>
<td><a href="{{route('post',$reply_comment->comment->post->slug)}}">{{$reply_comment->comment->post->title}}</a></td>
<td>{{$reply_comment->created_at->diffForHumans()}}</td>
Expand Down
8 changes: 4 additions & 4 deletions resources/views/post.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class="col-lg-4 col-md-12 right-side d-flex justify-content-end"
<div class="row flex-column">
<h5 class="text-uppercase pb-80">{{$post->comments->count()}} Comments</h5>
<br />
@foreach ($post->comments as $comment)
@foreach ($post->comments as $comment)
<div class="comment">
<div class="comment-list">
<div class="single-comment justify-content-between d-flex">
Expand All @@ -117,7 +117,7 @@ class="col-lg-4 col-md-12 right-side d-flex justify-content-end"
<h5><a href="#">{{$comment->user->name}}</a></h5>
<p class="date">{{$comment->created_at->format('D, d M Y H:i')}}</p>
<p class="comment">
{{$comment->comment}}
{{$comment->message}}
</p>
</div>
</div>
Expand Down Expand Up @@ -163,7 +163,7 @@ class="single-comment justify-content-between d-flex"
>
<div class="user justify-content-between d-flex">
<div class="thumb">
<img src="{{asset('storage/user/'.Auth::user()->image)}}" alt="{{Auth::user()->image}}" />
<img src="{{asset('storage/user/'.Auth::user()->image)}}" alt="{{Auth::user()->image}}" width="50px"/>
</div>
<div class="desc">
<h5><a href="#">{{Auth::user()->name}}</a></h5>
Expand Down Expand Up @@ -214,7 +214,7 @@ class="form-control mb-10"
@csrf
<textarea
class="form-control mb-10"
name="comment"
name="message"
placeholder="Messege"
onfocus="this.placeholder = ''"
onblur="this.placeholder = 'Messege'"
Expand Down
2 changes: 1 addition & 1 deletion resources/views/user/comments/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
@foreach ($comments as $key => $comment)
<tr>
<td>{{$key+1}}</td>
<td>{{$comment->comment}}</td>
<td>{{$comment->message}}</td>
<td>{{$comment->user->name}}</td>
<td><a href="{{route('post',$comment->post->slug)}}">{{$comment->post->title}}</a></td>
<td>{{$comment->created_at->diffForHumans()}}</td>
Expand Down
2 changes: 1 addition & 1 deletion resources/views/user/reply-comments/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
<tr>
<td>{{$key+1}}</td>
<td>{{$reply_comment->message}}</td>
<td>{{$reply_comment->comment->comment}}</td>
<td>{{$reply_comment->comment->message}}</td>
<td><a href="{{route('post',$reply_comment->comment->post->slug)}}">{{$reply_comment->comment->post->title}}</a></td>
<td>{{$reply_comment->created_at->diffForHumans()}}</td>
<td>
Expand Down

0 comments on commit e976fb2

Please sign in to comment.