从 POST 重定向到 laravel 中的 GET
Redirections from POST to GET in laravel
我已经在 url localhost/projects/create ($_GET) 上创建了表格,存储函数在 url localhost/projects.
public function store(Request $request) {
$project = new Project();
$project->title = request('title');
$project->description = request('description');
$project->save();
redirect('projects');
}
为什么从 lcoalhost/projects ($_POST, store-function) 到 localhost/projects ($_GET, index-function) 的重定向功能不起作用?
我使用命令 "php artisan make:controller ProjectController --resource" 创建了 ProjectController。我尝试从视频 https://laracasts.com/series/laravel-from-scratch-2018/episodes/10.
使用:
return redirect()->route('projects.index');
我已经在 url localhost/projects/create ($_GET) 上创建了表格,存储函数在 url localhost/projects.
public function store(Request $request) {
$project = new Project();
$project->title = request('title');
$project->description = request('description');
$project->save();
redirect('projects');
}
为什么从 lcoalhost/projects ($_POST, store-function) 到 localhost/projects ($_GET, index-function) 的重定向功能不起作用? 我使用命令 "php artisan make:controller ProjectController --resource" 创建了 ProjectController。我尝试从视频 https://laracasts.com/series/laravel-from-scratch-2018/episodes/10.
使用:
return redirect()->route('projects.index');