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 messageViewException
I get the error $name is undefined.
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
-
Answer # 1
Related articles
- about creating a controller for laraveladmin
- ruby on rails - about passing view and controller data with rails
- php - about overriding the laravel controller method
- java - i want to know about passing sql execution results between servlets
- c ++ - questions about passing by value and passing by reference
- about passing ruby arguments (arrays)
- php - about passing value to form using tag
- i can't add an action to the laravel controller
- php - about laravel: problems with unit testing (database testing)
- php - regarding passing laravel variables
- php - [laravel] questions about eloquent optimization
- php - about the scope of laravel variables
- php - about laravel eloquent
- about laravel docker
- javascript - about passing values between pages of nextjs
- php - i can see that there is no controller in laravel
- php - the controller specified in laravel apiresource cannot be found
- laravel controller
- php - laravel controller
- about laravel's eloquent
Trends
What you can see by looking at the source
@if (true == true)
So I feel like going to
$name
before logging in