Added the ability to add project information.
This commit is contained in:
@@ -50,6 +50,23 @@ final class ProjectService extends Service
|
||||
]);
|
||||
}
|
||||
|
||||
public function show(int $id, User $user): ServiceResultError | ServiceResultArray
|
||||
{
|
||||
$project = $this->projectRepository->getProjectById($id);
|
||||
|
||||
if (is_null($project)) {
|
||||
return $this->errNotFound(__('Not Found'));
|
||||
}
|
||||
|
||||
if ($user->cannot('view', $project)) {
|
||||
return $this->errFobidden(__('Access is denied'));
|
||||
}
|
||||
|
||||
return $this->result([
|
||||
'project' => $project,
|
||||
]);
|
||||
}
|
||||
|
||||
public function create(User $user): ServiceResultError | ServiceResultArray
|
||||
{
|
||||
if ($user->cannot('create', Project::class)) {
|
||||
|
||||
Reference in New Issue
Block a user