From 1c85a934c1a10a605eec24baf5e08bd7207d7d25 Mon Sep 17 00:00:00 2001 From: NishaSharma14 Date: Wed, 16 Nov 2022 14:49:00 +0100 Subject: [PATCH] fix: add misisng comments. --- app/Actions/Project/UpdateProject.php | 28 +++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/app/Actions/Project/UpdateProject.php b/app/Actions/Project/UpdateProject.php index 3d391e53..39c9491b 100644 --- a/app/Actions/Project/UpdateProject.php +++ b/app/Actions/Project/UpdateProject.php @@ -172,6 +172,30 @@ public function detachAuthor(Project $project, $author_id) ); } + /** + * Update existing Contributor type for a given author in a project. + * + * @param \App\Models\Project $project + * @param string $authorId + * @param string $role + * @return void + */ + public function updateContributorType(Project $project, $author_id, $role) + { + $project->authors()->updateExistingPivot($author_id, [ + 'contributor_type' => $role, + ]); + } + + /** + * Attach citations to a project. + * + * @param \App\Models\Project $project + * @param \App\Models\User $user + * @param array $citations + * @return void + */ + public function syncCitations(Project $project, $citations, $user) { $citations_map = []; @@ -182,10 +206,6 @@ public function syncCitations(Project $project, $citations, $user) $project->citations()->sync( $citations_map ); - - // $project->citations()->sync( - // $citations, ['user' => $user->get('id')] - // ); } /**