title: Like + Dislikes Laravel
body: <p>I am working on a web programing assignment for University and have hit a snag when trying to make a like and dislike function for a comments area of a guestbook.</p>
  
  <p>Evectively the numbers on the site should update by one once either the dislike or like button is pressed.</p>
  
  <p>My comments display correctly however the liking function is broken and I have no idea how to fix it.</p>
  
  <p>Here is my code</p>
  
  <pre><code>Controller (LikesController.php)
  
  &lt;?php
  
  namespace App\Http\Controllers;
  
  use Illuminate\Http\Request;
  
  class LikesController extends Controller (It says my Like Controller is never used not sure why this is)
  {
      public function likepl (Comment, $comment) { (Says that Comment is "Undefined" also not sure why this is)
          $comment -&gt; likePlus (); (Method likePlus not found)
          return redirect () -&gt; action ('CommentController@index');
      }
  }
  
  
  
  
  Model (comment.php)
  
  &lt;?php
  
  namespace App;
  
  use Illuminate\Database\Eloquent\Model;
  
  class Comment extends Model
  {
  
      public static function paginate(int $COMMENTS_PER_PAGE)
      {
      }
  
  
      public function likePlus()
      {
          $this -&gt; likes += 1;
          $this -&gt; update ();
      }
  
      public function dislikePlus()
      {
          $this -&gt; dislikes += 1;
          $this -&gt; update ();
      }
  }
  
  
  
  
  View Page (comment.comments)
  
  @extends('setup')
  @section('content')
      &lt;div class="container main-table"&gt;
          &lt;div class="box"&gt;
              &lt;h1 class="title"&gt;Guest book Comments&lt;/h1&gt;
              @if (count ($comments) &gt; 5)
                  &lt;table class="table is-striped is-hoverable"&gt;
                      &lt;thead&gt;
                      &lt;tr&gt;
                          &lt;th&gt;User&lt;/th&gt;
                          &lt;th&gt;Comment&lt;/th&gt;
                          &lt;th&gt;Date&lt;/th&gt;
                          &lt;th&gt;Likes&lt;/th&gt;
                          &lt;th&gt;DisLikes&lt;/th&gt;
                      &lt;/tr&gt;
                      &lt;/thead&gt;
                      &lt;tr&gt;
                      @foreach ($comments as $c)
  {{--declaring the comments--}}
                          &lt;tr&gt;
                              &lt;td&gt;{{ $c -&gt; user }}&lt;/td&gt;
                              &lt;td&gt;{{ $c -&gt; comments }}&lt;/td&gt;
                              &lt;td&gt;{{ $c -&gt; created_at -&gt; format ('D jS F') }}&lt;/td&gt;
                              &lt;td&gt;{{ $c -&gt; likes }}&lt;/td&gt;
                              &lt;td&gt;{{ $c -&gt; dislikes }}&lt;/td&gt;
                          &lt;/tr&gt;
  
                      &lt;tr class="icon heart"&gt;
                          &lt;td&gt;&lt;a class="button" href="/comment/{{ $c -&gt; id }}/like/"&gt;&lt;ion-icon name="md-heart"&gt;&lt;/ion-icon&gt;&lt;/a&gt;&lt;/td&gt;
                          &lt;td&gt;&lt;a class="button" href="/comment/{{ $c -&gt; id }}/dislike/"&gt;&lt;ion-icon name="md-heart-empty"&gt;&lt;/ion-icon&gt;&lt;/a&gt;&lt;/td&gt;
                      &lt;/tr&gt;
                          @endforeach
                  &lt;/table&gt;
                  {{ $comments -&gt; links() }} {{-- Setting pagination--}}
                          @else
                  &lt;div class="notification is-info"&gt;
                      &lt;p&gt;
                          The Guest book is empty. Why not add a comment?
                      &lt;/p&gt;
                  &lt;/div&gt;
              @endif
          &lt;/div&gt;
      &lt;/div&gt;
  @endsection
  </code></pre>
  
  <p>I have annotated the code with the visible errors that I get as for better refference.</p>
  
  <p>Here are the Routes that I am using for the comments page.</p>
  
  <pre><code>Route::get('/','CommentController@index');
  Route::get('/comment/{comment}/like/', 'LikesController@likePl');
  Route::get('/comment/{comment}/dislike/', 'DislikesController@dislikePl');
  </code></pre>