first commit
This commit is contained in:
22
app/Services/ProjectMemberService.php
Normal file
22
app/Services/ProjectMemberService.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Models\Project;
|
||||
|
||||
class ProjectMemberService
|
||||
{
|
||||
public static function getMembers(int $projectId): array
|
||||
{
|
||||
return Project::find($projectId, 'id')
|
||||
->where('id', $projectId)
|
||||
->with('users')
|
||||
->first()
|
||||
->only(['id', 'users']);
|
||||
}
|
||||
|
||||
public static function syncMembers(int $projectId, array $users): array
|
||||
{
|
||||
return Project::findOrFail($projectId)->users()->sync($users);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user