Answer the question
In order to leave comments, you need to log in
Blade template engine variable inheritance in Laravel child templates?
There is an IndexController controller
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class IndexController extends Controller
{
public function getIndex()
{
$year = '2018';
return view('index', ['year' => $year]);
}
}
Route::get('/', '[email protected]')->name("home");
@section('hello')
<h1>Hello, world! {{ $year }}</h1>
@show
@extentds('welcome')
@section('hello')
@parent
<h2>Hello, {{ $year }}</h2>
@endsection
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question