Hi everyone I am facing an issue
I was using this layout architecture before and facing this issue
in master.blade.php
code.....
@php $foo = "bar"; @endphp
@yield('main')
code ends....
in contact.blade.php
@extends('master')
code...
@section('main')
@php echo $foo; @endphp
@endsection
code ends...
ERROR: undefined varibale foo in contact.blade.php
.......................................................................
then I switched to the new architecture and again I am facing the same issue.
in master.blade.php
code.....
@php $foo = "bar"; @endphp
code ends....
in contact.blade.php
code...
@includes('master')
@php echo $foo; @endphp
code ends...
ERROR: undefined varibale foo in contact.blade.php
So suggest me what I have to do to access the variable.
Add
@php global $foo; @endphp
in all your blades.
Solve my problem as I'm using a variable in my sub-blade to control what javascript to include (avoiding duplicate) in master.