Skip to main content

spatie/freek.dev

637 stars
2 code files
View spatie/freek.dev on GitHub

app/View/Components/SeriesNextPostComponent.php

Open in 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'));
}
}

resources/views/components/series-next-post-component.blade.php

Open in GitHub
@if ($nextPost)
This series is continued in <a href="{{ route('post', $nextPost->slug) }}">{{ lcfirst($nextPost->series_toc_title) }}</a>.
@endif

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.