Support the ongoing development of Laravel.io →
Views Requests Laravel
Last updated 2 years ago.
0

Hi there, you are using empty which is a php function that checks if a variable is false, or null, or not declared. The laravel collection however does exist. You should use isEmpty

https://laravel.com/docs/5.7/collections#method-isempty

@if($related->isEmpty())
   Dont show
@else
  <div class="section-title">
      <h2><span>Related Posts</span></h2>
  </div>
@endif
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.