I have a method in which I output the variable to the view. In the view, I check if the variable is true, then show the desired block, and if it is false, then do not show the block. But for some reason this does not work for me.

```
@if($mainAlbum)
   <div class="card">
      <a href="{{route('allAlbums', ['id' => $user->id])}}"><h1 class="mt-2 mb-2" style="font-size: 0.9rem; margin-left: 5px; color: black;">Плейлисты<img src="{{asset('img/right.png')}}" width="11"> </h1></a>
      @foreach($mainAlbum as $album)
          <a href="{{route('album', ['id' => $user->id, 'album' => $album->id])}}"><img src="{{$album->cover}}" class="img-fluid"></a>    
      @endforeach
   </div>
@endif

```

and method 

```
public function index($id) {
    $user = User::find($id);
    $posts = $user->profile()->orderBy('created_at', 'desc')->paginate(2);
    $mainVideo = $user->profileVideo()->orderBy('created_at', 'desc')->limit(1)->get();
    $mainAlbum = $user->profileAlbums()->orderBy('created_at', 'desc')->limit(1)->get();
    return view('profile.profile', compact('user', 'posts', 'mainVideo', 'mainAlbum'));
}

```