Level 28
In your blade:
@forelse($posts as $post)
{{ $post->title }}
@empty
No results found
@endforelse
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Standard search function:
$posts = Post::where('title', 'like', "%$query%")
->paginate(5);
It's work, but when search dont find query they show blank page. Question is how show string like "No results"
In your blade:
@forelse($posts as $post)
{{ $post->title }}
@empty
No results found
@endforelse
Please or to participate in this conversation.