0
我有2個公共職能在我的控制器如何在Laravel做到這一點5.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')視圖
這個怎麼辦?
做到了合作者的價值,但發生下列錯誤未定義的變量:協作者(查看:C:\ Users \ Fernando \ Desktop \ c \ resources \ views \ collaborators \ form.blade.php) – Fernando