Overwriting blocks when extending blade #49126
Unanswered
TheGodlyLuzer
asked this question in
Ideas
Replies: 2 comments 3 replies
-
It's a good idea, like twig, if you extends an existing twig file, that allows you to override specified blocks |
Beta Was this translation helpful? Give feedback.
0 replies
-
You can already do this by using the
<h1>title</h1>
@section('foo_main')
<h3>foo</h3>
@show
@extends('foo')
@section('foo_main')
<h3>bar</h3>
@endsection Optionally keep parent content:
@extends('foo')
@section('foo_main')
@parent
<h3>bar</h3>
@endsection More info here: https://laravel.com/docs/10.x/blade#layouts-using-template-inheritance |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
It would be amazing to have the possibility to override some blocks of code when extending a blade, similar to twig.
foo.blade.php
bar.blade.php
Would result in
Beta Was this translation helpful? Give feedback.
All reactions