I am using Laravel-10 Frame work. For title tags, I am using $title
in the header and then declaring $title
on each individual page. On some pages it works, and in some pages with same code, I get an undefined variable $title
error.
My header file is inside views->layouts->app.blade.php
and inside I have title tag:
<title>{{$title}}</title>
On all the pages, I am declaring $title
as:
@extends('layouts.app.blade')
@section('content')
@php
$title="Contact";
@endphp
@endsection
Issue, on the pages which are placed directly under views folder, I do not get any error. But if the page is under any sub-folder, for example, views->auth->passwords->reset.blade.php
, I get undefined variable $title
error.