fix: 🐛 was using wrong the Alexis Gousseau HasCache Trait

This commit is contained in:
K Muller 2025-12-17 17:14:20 +01:00
parent 0ee8faf836
commit 497d0045b4
2 changed files with 6 additions and 10 deletions

View file

@ -10,7 +10,6 @@ use App\Models\Document;
use App\Models\DocumentCategory;
use App\Models\DocumentTag;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB;
use Inertia\Inertia;
use Uwil\LaravelBackend\Resources\CommonResource;
@ -78,8 +77,8 @@ class DocumentController extends Controller
return Inertia::render('Document/Create', [
'data' => CommonResource::make($document->load('tags')),
'enumDocumentStatus' => DocumentStatusEnum::toArray(),
'tags' => Cache::get(DocumentTag::getCacheKey()),
'categories' => Cache::get(DocumentCategory::getCacheKey()),
'tags' => DocumentTag::getModelsCached(),
'categories' => DocumentCategory::getModelsCached(),
'modelName' => $this->modelName,
'enumYears' => YearsEnum::toArray()
]);
@ -129,14 +128,12 @@ class DocumentController extends Controller
*/
public function edit(Document $document): \Inertia\Response
{
$documentTags = DocumentTag::all();
$documentCategories = DocumentCategory::all();
return Inertia::render('Document/Edit', [
'data' => CommonResource::make($document->load('tags', 'categories')),
'enumDocumentStatus' => DocumentStatusEnum::toArray(),
'enumYears' => YearsEnum::toArray(),
'tags' => Cache::get(DocumentTag::getCacheKey()),
'categories' => Cache::get(DocumentCategory::getCacheKey()),
'tags' => DocumentTag::getModelsCached(),
'categories' => DocumentCategory::getModelsCached(),
'modelName' => $this->modelName
]);
}

View file

@ -8,7 +8,6 @@ use App\Http\Requests\Back\News\UpdateNewsRequest;
use App\Models\News;
use App\Models\NewsCategory;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB;
use Inertia\Inertia;
use Uwil\LaravelBackend\Resources\CommonResource;
@ -82,7 +81,7 @@ class NewsController extends Controller
'data' => CommonResource::make($news),
'modelName' => $this->modelName,
'enumNewsStatus' => NewsStatusEnum::toArray(),
'newsCategory' => Cache::get(NewsCategory::getCacheKey()),
'newsCategory' => NewsCategory::getModelsCached(),
]);
}
@ -133,7 +132,7 @@ class NewsController extends Controller
'data' => CommonResource::make($news->load('categories')),
'modelName' => $this->modelName,
'enumNewsStatus' => NewsStatusEnum::toArray(),
'newsCategory' => Cache::get(NewsCategory::getCacheKey())
'newsCategory' => NewsCategory::getModelsCached()
]);
}