title: How to display my Laravel blade file items according to if-else conditions?
body: <p>I need to display some different items according to an authenticated user id in Laravel blade file. This is the first condition that I need to display:</p>
  
  <pre><code>@foreach ($task-&gt;comments as $comment)
  @if(auth()-&gt;user()-&gt;id == $task-&gt;user_id) 
      &lt;div&gt;
                      &lt;div&gt;&lt;i class="fa fa-check-square-o"&gt;&lt;/i&gt;
                      &lt;span&gt;{{ $comment-&gt;comments }} by
                         &lt;span style="font-style: italic;color: #09f;"&gt;
                         {{ ($comment-&gt;user()-&gt;first()-&gt;username === auth()-&gt;user()-&gt;username) ? 'You' : $comment-&gt;user()-&gt;first()-&gt;username }} 
                         &lt;/span&gt;
                      &lt;/span&gt;&lt;/div&gt;
                      &lt;a href="/projects/{{ $task-&gt;project-&gt;id }}/comments/{{ $comment-&gt;id }}/edit"&gt;Edit&lt;/a&gt;
                      &lt;button class="btn btn-danger delete pull-right"
                        data-action="/projects/{{ $task-&gt;project-&gt;id }}/comments/{{ $comment-&gt;id }}"
                        data-token="{{csrf_token()}}"&gt;
                      &lt;i class="fa fa-trash-o"&gt;&lt;/i&gt;Delete
                      &lt;/button&gt;
                  &lt;/div&gt;
                  &lt;hr/&gt;
  @endif 
  @endforeach
  &lt;form class="form-vertical" role="form" method="post" action="{{ route('projects.comments.create', ['projectId'=&gt; $project-&gt;id, 'taskId'=&gt;$task-&gt;id])}}"&gt;
          &lt;div class="form-group{{ $errors-&gt;has('comments') ? ' has-error' : '' }}"&gt;
              &lt;textarea name="comments" class="form-control" style="width:80%;" id="comment" rows="5" cols="5"&gt;&lt;/textarea&gt;
              @if ($errors-&gt;has('comments'))
                  &lt;span class="help-block"&gt;{{ $errors-&gt;first('comments') }}&lt;/span&gt;
              @endif
          &lt;/div&gt;
  
          &lt;div class="form-group"&gt;
              &lt;button type="submit" class="btn btn-info"&gt;Add Comment&lt;/button&gt;
          &lt;/div&gt;
          &lt;input type="hidden" name="_token" value="{{ csrf_token() }}"&gt;
      &lt;/form&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>and if the condition above doesn't meet, I need to display following conditions:</p>
  
  <pre><code>@else
  &lt;div&gt;&lt;i class="fa fa-check-square-o"&gt;&lt;/i&gt;
                      &lt;span&gt;{{ $comment-&gt;comments }} by
                         &lt;span style="font-style: italic;color: #09f;"&gt;
                         {{ ($comment-&gt;user()-&gt;first()-&gt;username === auth()-&gt;user()-&gt;username) ? 'You' : $comment-&gt;user()-&gt;first()-&gt;username }} 
                         &lt;/span&gt;
                      &lt;/span&gt;&lt;/div&gt; 
  &lt;form class="form-vertical" role="form" method="post" action="{{ route('projects.comments.create', ['projectId'=&gt; $project-&gt;id, 'taskId'=&gt;$task-&gt;id])}}"&gt;
          &lt;div class="form-group{{ $errors-&gt;has('comments') ? ' has-error' : '' }}"&gt;
              &lt;textarea name="comments" class="form-control" style="width:80%;" id="comment" rows="5" cols="5"&gt;&lt;/textarea&gt;
              @if ($errors-&gt;has('comments'))
                  &lt;span class="help-block"&gt;{{ $errors-&gt;first('comments') }}&lt;/span&gt;
              @endif
          &lt;/div&gt;
  
          &lt;div class="form-group"&gt;
              &lt;button type="submit" class="btn btn-info"&gt;Add Comment&lt;/button&gt;
          &lt;/div&gt;
          &lt;input type="hidden" name="_token" value="{{ csrf_token() }}"&gt;
      &lt;/form&gt;
  </code></pre>
  
  <p>How can I do this?</p>