Example of Blade components in spatie/freek.dev

File app/View/Components/SeriesNextPostComponent.php (link to Github)
use App\Models\Post;
use Illuminate\View\Component;

class SeriesNextPostComponent extends Component
{
    public function render()
    {
        $nextPost = Post::query()
            ->where('series_slug', $this->post->series_slug)
            ->where('id', '>', $this->post->id)
            ->orderBy('id')
            ->first();

        return view('components.series-next-post-component', compact('nextPost'));
    }
}
File resources/views/components/series-next-post-component.blade.php (link to Github)
@if ($nextPost)
This series is continued in <a href="{{ route('post', $nextPost->slug) }}">{{   lcfirst($nextPost->series_toc_title) }}</a>.
@endif

Additional resources on blade components: