0

i trie to change title page use

@section('page_title', {{  $mapel->subjects_name  }} )

but view error message

syntax error, unexpected '<', expecting ')' (View: /mnt/187621C87621A788/ProjekWeb/eLearning/resources/views/lesson/index.blade.php)

in my controller

public function show($id)
{
    $mapel = Subjects::findOrFail($id);
    return view('lesson.index', compact('mapel'));
}

I've tried to check with dd($mapel->subjects_name) and the data comes out, thank u

1
  • 4
    change to @section('page_title', $mapel->subjects_name) you don't need to parse blade syntax inside the blage directives Documentation Commented Sep 9, 2021 at 3:35

1 Answer 1

1

why you need to compact it, I think you can directly send $mapel like

return view('lesson.index', $mapel);

then in view

@section('page_title', $mapel->subjects_name );

or

@section('page_title', ['mapel_subject_name' => $mapel->subjects_name] )

whatever you prefer.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.