0
5.2Laravelでこれを行うにはどのように私は私のコントローラで2公共の機能を持っている
public function index()
{
$projects = Project::personal()->get();
return view('projects.index')->withProject($projects);
}
他の一つは
public function show($id) {
$project = Project::find($id);
$tasks = $this->getTasks($id);
$files = $this->getFiles($id);
$comments = $this->getComments($id);
$collaborators = $this->getCollaborators($id);
return view('projects.show')->withProject($project)->withTasks($tasks)->withFiles($files)->withComments($comments)->withCollaborators($collaborators);}
は、私は私のパブリック関数インデックスに
$collaborators = $this->getCollaborators($id);
を得る必要あり( 'projects.index')ビューで共同編集者を印刷する()メソッド
どうすればいいですか?
のための協力者値を持つことになり、それをしなかったが、次のエラーが発生しました未定義の変数:コラボレーター(View:C:\ Users \ Fernando \ Desktop \ c \ resources \ views \ collaborator/form.blade.php) – Fernando