我正在使用Laravel應用程序。我需要在視圖文件中的項目文件夾中路由collaborator.blade.php文件。我有下面的表格和填寫表格數據後保存它需要重定向到collaborator.blade.php文件。我的表格與項目控制器一起工作如何在laravel中路由我的刀片文件5.2
$project = new Project;
$project->project_name = $request->input('name');
$project->project_status = $request->input('status');
$project->group = $request->input('group');
$project->color = $request->input('color');
$project->project_notes = $request->input('notes');
$project->user_id = Auth::user()->id;
$duplicate = Project::where('project_name',$project->project_name)->first();
if($duplicate)
{
return redirect()->route('projects.index')->with('warning','Title already exists');
}
$project->save();
return redirect()->route('projects.collaborators')->with('info','Your Project has been created successfully');
}
但是當我點擊表單按鈕系統時,發生了這樣的錯誤消息。
Route [projects.collaborators] not defined.
如何解決這個問題? 編輯 新航線
Route::get('/collaborators', function(){
return view('projects.collaborators');
});
然後發生以下錯誤消息
Route [projects.collaborators] not defined.
路線需要在'routes.php'which可以在laravel根目錄下'應用程序中找到/ Http'請參閱https://github.com/laravel/laravel/blob/5.2/app/Http/routes.php – chilly
請參閱我已編輯的答案 – John