There is one div inside which foreach works for me. Before this div I do a check
@if($events)
<div class="card mb-5">
....
If true, then show the block, if false, do not show. But the block is still visible, it returns me an empty collection. How to fix it?
public function index($id) {
$user = User::find($id);
$events = $user->events()->orderBy('eventdata', 'desc')->limit(3)->get();