コード例 #1
0
 private function linkToFaculty(Project $project, array $input)
 {
     $faculty = $project->createdBy->faculty;
     if ($faculty) {
         $project->faculty()->associate($faculty)->save();
     }
     return $project;
 }
コード例 #2
0
 private function linkToFaculty(Project $project, array $input)
 {
     if (isset($input['faculty'])) {
         $id = $input['faculty']['id'];
         $faculty = Faculty::find($id);
         $project->faculty()->associate($faculty)->save();
     }
     return $project;
 }