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