我有一个基本的表单应该记录用户但是一开始我想返回一个视图,因为表单是使用控制器提交的,任何帮助都非常感谢。 这是形式,我不认为有很多值得关注,但无论如何我发布它:
form class="form-horizontal" action="{{ route('login')}}" method="post">
<div class="form-group horseLoginForum">
<input type="username" class="form-control" id="username" placeholder="username">
<br>
<button type="submit" class="btn btn-default">Sign in</button>
<input type="hidden" value="{{ Session::token() }}" name="_token">
</div>
它使用的路线就在下面:
Route::post('login','UserController@userLogIn')->name('login');
最后这是UserController函数:
function userLogIn(Request $request)
{
return view('news');
}
Laravel版本5.4
我没有收到任何错误。
这是我的composer.json文件。我在那里尝试了一些东西
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.6.4",
"laravel/framework": "5.4.*",
"laravel/tinker": "~1.0"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~5.7"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"post-root-package-install": [
"php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
],
"post-install-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postInstall",
"php artisan optimize"
],
"post-update-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postUpdate",
"php artisan optimize"
]
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true
}
}
答案 0 :(得分:0)
page = "home"
在composer.json文件中添加它 然后是作曲家更新