Skip to content

Commit

Permalink
Fix edit content
Browse files Browse the repository at this point in the history
  • Loading branch information
daVitekPL committed Mar 27, 2024
1 parent 17dc74c commit 0060f23
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/Repositories/H5PContentRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,8 @@ public function create(string $library, string $params, string $nonce): int

public function edit(int $id, string $library, string $params, string $nonce): int
{
$libNames = $this->hh5pService->getCore()->libraryFromString($library);

$libDb = H5PLibrary::where([
['name', $libNames['machineName']],
['major_version', $libNames['majorVersion']],
['minor_version', $libNames['minorVersion']],
])->latest()->first();
$content = H5PContent::where('id', $id)->first();
$libDb = H5PLibrary::where('id', $content->library_id)->first();

if ($libDb === null) {
throw new H5PException(H5PException::LIBRARY_NOT_FOUND);
Expand All @@ -86,8 +81,6 @@ public function edit(int $id, string $library, string $params, string $nonce): i
throw new H5PException(H5PException::INVALID_PARAMETERS_JSON);
}

$content = H5PContent::where('id', $id)->first();

if ($content === null) {
throw new H5PException(H5PException::CONTENT_NOT_FOUND);
}
Expand Down

0 comments on commit 0060f23

Please sign in to comment.