F
F
flafy42019-05-20 22:41:03
Laravel
flafy4, 2019-05-20 22:41:03

How to correctly implement data transfer to the parent Blade template?

index.blade.php

@extends('layouts.site')

@section('content')
    {{ $data }}
@endsection

layouts/site.blade.php
<main class="py-4">
       {{ $data }}
       @yield('content')
</main>

How to display data in parent template? out index.blade.phptolayouts/site.blade.php

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry, 2019-05-21
@Astatroth

You don't have to move anything. The data is already available in the parent template.

A
Arthur, 2019-05-20
@ART_CORP

https://laravel.com/docs/5.8/blade
An example if I understand you correctly.
@extends('master', ['title' => $title])

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question