try this
view('posts.show')->renderSections()['content']
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi,
Say I have a Blade template like this, saved in resources/views/posts/show.blade.php:
@extends('layout.default')
@section('header')
single post title
@stop
@section('content')
single post content and other things
@stop
I know I can @include('posts.show') in another template, which is great. However, can I just @include() a part of this template, like the content section?
If I can avoid it I don't want to create another template to solve this problem, I was just wondering if there's a way to include a section of a template rather than the whole thing?
Please or to participate in this conversation.