Home>
About passing data from the controller to the screen

Passing data from the controller that displays the screen to the screen to display

Error message

ViewException
I get the error $name is undefined.

Applicable source code
Controller code
public function registUser (Request $request) {
        / *
         Perform registration processing in the database
        * /
        return view ('home')->with ('name', $request->only ('name'));
    }
Component code used for the display screen
<header>
  
   
    <p>Laravel</p>
   
   
    <ul>
     @if (true == true)
      <li>Logout</li>
      <li>{{$name}}</li>
     @else
      <li>Login</li>
      <li>Regist</li>
     @endif
    </ul>
   
  
</header>
Source code
Supplemental information (FW/tool version etc.)

Development environment OS Windows10
Editer Visual Studio Code
laravel version 6.3.0