Laravel-blade- @ extends does not work and missing snippet?

0

I have a problem with @extends, it does not activate, it goes blank when I make the request for the route:

Route::get('/demos', function () {
    return view('demo');
});

I get the following error:

  

(2/2) ErrorException Can not end a section without first starting   one. (View: C: \ wamp64 \ www \ gestiondatos \ resources \ views \ demo.blade.php)

I've been told it's because of the snippet, but I do not know how to activate it.

I attach the image, as you can see they are blank.

    
asked by luis b 07.08.2017 в 23:24
source

1 answer

2

The error is on line 7.

When we pass 2 parameters to @section blade, it is responsible for auto-closing the section, so we should not include the @endsection tag for that section. p>

@extends('layouts.master')

@section('titulo', 'Mi titulo')// se cierra @section automáticamente

// Esta etiqueta @endsection sobra
@endsection

@section('content')
    Hola mundo!

// Aquí si se debe cerrar
@endsection

Although passing parameters to @endsection does not generate any errors, it is meaningless, since it does not support any parameters.

Therefore your code could look something like this:

@extends('layouts.master')

@section('titulo', 'Mi titulo')

@section('content')
    Contenido de la sección 
@endsection
    
answered by 08.08.2017 / 00:13
source