我在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,存储函数(到localhost/projects($_GET,索引函数(?我用命令"php artisan make:controller ProjectController--resource"创建了ProjectController。我从视频中尝试https://laracasts.com/series/laravel-from-scratch-2018/episodes/10.
使用:
return redirect()->route('projects.index');