P
P
Pavel Konchich2021-01-15 23:39:52
Laravel
Pavel Konchich, 2021-01-15 23:39:52

How to write @yield('style') in default layout?

An interesting question, Laravel 8 has default.blade.php - as a standard layout.

Pages/home.blade.php is also written with the following content:

@section('metricks')
    
    @foreach($metricks as $metrick)
    {{$metrick->value}}
    @endforeach

@endsection


If in default I insert through @yield()- then everything is displayed in <body>

How to display in <head>this section?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
D
Dmitry, 2021-01-16
@konchychp

There are no default blades in laravel8. Absolutely not. So you installed additional packages. Breeze? ui? jetstream? This is just to understand. At the same time, 8ka already uses a component approach at the core.
To draw a conclusion in the head - nothing prevents you from scoring it directly. It makes sense to produce sections if it is about metrics.
Right in default.blade.php and output the loop.
If you really want to make it a section, then in default.blade.php

<head>
...
@yield('metrics')

and in metricks.blade.php
@extends ('default')

@section ('metricks')
...
@endsection

I am not a supporter of references to the docks, but as for the blade, everything is clearly shown.

S
Saboteur, 2017-05-07
@saboteur_kiev

Learn Perl to junior - I would recommend to anyone who works with scripting languages ​​- Perl is very convenient to parse data, and in itself it is very simple, so it will not take much time.
Sometimes simple things are easier to write in perl and run than to write them in python/php. But actually the question of whether to go deep or not can be solved later, when you master the pearl at a minimum level by writing a couple of parsers / utilities.
That is, it is better to learn pearls professionally already in practice, if there is work related to pearls.

D
Dimonchik, 2017-05-07
@dimonchik2013

if you want to break your brain - better Lisp or Haskell, more productive with even more vacancies than Perl

H
hektr, 2017-09-21
@hektr

It is already being replaced by python everywhere. They are tailored to solve the same range of tasks, but the python is much more popular, especially in new projects.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question