$title is undefined Make the variable optional in the blade template. Replace {{ $title }} with {{ $title ?? '' }}
index.blade.php is working
@extends('layouts.app')
@section('content')
{{ $title }}
@endsection
but the about and service not working with the same code .
in my PageController.php
public function index(){
$title = 'welcome hiii';
return view('pages.index')->with('title', $title);
}
public function about(){
$title = 'welcome hiiissssssss';
return view('pages.about')->with('title', $title);
}
public function services(){
$data = array(
'title' => 'services'
);
return view('pages.services')->with($data);
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…