Chandra Shekhar
Chandra Shekhar

Reputation: 3749

Laravel Issue with @extend layouts

I am newbie to PHP Laravel Framework. I am facing a issue regarding extending layouts using @extends. Here is the scenario:-

I am having a default Layout (layout->index.blade.php), and a view extending that layout detailjournal.blade.php (journal->detailjournal.blade.php). Now i want to create partials inside journal folder. It contains leftSection.blade.php and rightSection.blade.php. What i need is to yield these two partials into the detailsjournal.blade.php.

I have tried using @include, but i want to @yield.

Is this possible? If yes then how can i achieve it?

here is the folder structure.
|-views
  |-layouts
    |- default.blade.php
  |-journal
    |-partials
      |-leftSection.blade.php
      |-rightSection.blade.php
    |-detailsjournal.blade.php

Upvotes: 0

Views: 197

Answers (3)

You can try something like this

@section('detailsJournal') 
<div class="">
    @include('journal.partials.leftsection')
    @yield('content')
</div>
<div class="">
    @include('journal.partials.rightsection')
</div>

Upvotes: 0

Kuldeep Mishra
Kuldeep Mishra

Reputation: 4040

if u want to include just use

@include('journal.leftSection')

if your files in includes folder then

@include('include.journal.leftSection')

Upvotes: 0

Tudor
Tudor

Reputation: 1898

You can simply do @include('journal.leftSection') and @include('journal.rightSection') where you want them included.

Upvotes: 1

Related Questions