Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add QueryCachable trait #199

Merged
merged 2 commits into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Models/H5PContent.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace EscolaLms\HeadlessH5P\Models;

use EscolaLms\Core\Models\Traits\QueryCacheable;
use EscolaLms\Core\Models\User;
use EscolaLms\HeadlessH5P\Database\Factories\H5PContentFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
Expand Down Expand Up @@ -89,7 +90,7 @@

class H5PContent extends Model
{
use HasFactory;
use HasFactory, QueryCacheable;

protected $table = 'hh5p_contents';

Expand Down
3 changes: 2 additions & 1 deletion src/Models/H5PContentLibrary.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@

namespace EscolaLms\HeadlessH5P\Models;

use EscolaLms\Core\Models\Traits\QueryCacheable;
use EscolaLms\HeadlessH5P\Database\Factories\H5PContentLibraryFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class H5PContentLibrary extends Model
{
use HasFactory;
use HasFactory, QueryCacheable;

public $incrementing = false;

Expand Down
3 changes: 2 additions & 1 deletion src/Models/H5PLibrary.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace EscolaLms\HeadlessH5P\Models;

use EscolaLms\Core\Models\Traits\QueryCacheable;
use EscolaLms\HeadlessH5P\Database\Factories\H5PLibraryFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
Expand Down Expand Up @@ -117,7 +118,7 @@

class H5PLibrary extends Model
{
use HasFactory;
use HasFactory, QueryCacheable;

protected $table = 'hh5p_libraries';

Expand Down
2 changes: 1 addition & 1 deletion tests/Repositories/H5PRepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public function testDeleteLibraryUsageShouldDeleteLibrariesById(): void

$this->repository->deleteLibraryUsage($h5pContent->getKey());

$this->assertCount(0, H5PContent::find($h5pContent->getKey())->libraries);
$this->assertCount(0, $h5pContent->refresh()->libraries);
}

public function testDeleteLibraryUsageShouldFailWhenContentNotExists(): void
Expand Down
Loading