Reputation: 21
I want to make @yield('dynamic')
to load different pages like single page application in laravel.
Route:
Route::get(
'/front-office-setup/{setup_type}',
'AdmissionFrontOfficeSetupController@index'
)->name('frontofficesetupview');
Controller:
public function index($setup_type)
{
$data['setup_type'] = $setup_type;
return view('frontoffice::frontofficesetup.frontofficesetup', $data);
}
View:
<div class="row">
<div class="col-md-3">asdf</div>
<div class="col-md-4">asdf</div>
<div class="col-md-5"> @yield('{{$setup_type}}')</div>
</div>
Section:
@extends('frontoffice::frontofficesetup.frontofficesetup')
@section('visitor-purpose')
sdfasd
@endsection
But it doesn't render or show in @yield('{{$setup_type}}')
Is there any way to do this?
Edit part* Also i have already included a @yield type of things in view file
@extends('backend.master.master')
@section('content')
<div class="row">
<div class="col-md-3">asdf</div>
<div class="col-md-4">asdf</div>
<div class="col-md-5"> @yield($setup_type)</div>
</div>
@endsection
Upvotes: 0
Views: 541
Reputation: 597
@yield is already started PHP tag <?php
. SO no need to mention braces again{{}}
. Simply try @yield($setup_type)
It will work perfectly.
Upvotes: 3