Код: Выделить всё
public function fetch(): void
{
if ($this->userToShowFeedFor == null) {
$this->tweets = Tweet::with('user')->withCount('likes')->get();
} else {
$this->tweets = $this->userToShowFeedFor->tweets;
}
}
Код: Выделить всё
@if (!$userToShowFeedFor)
[url={{ route(] $tweet->user]) }}"
class="text-gray-600 cursor-pointer underline">u/{{ $tweet->user->username }}[/url]
@else
u/{{ $tweet->user->username }}
@endif

Я даже использовал Tinker, чтобы убедиться, что я не выполняю никаких плохих SQL-запросов под капотом, и все выглядит хорошо.

Подробнее здесь: https://stackoverflow.com/questions/774 ... ding-is-di
Мобильная версия