bugfixes
Some checks are pending
Build & Push Docker Image / docker (push) Waiting to run

This commit is contained in:
Ahmed Darrazi 2025-12-17 13:16:04 +01:00
parent 96014dc222
commit a11eeb94c7
3 changed files with 52 additions and 4 deletions

View File

@ -0,0 +1,32 @@
name: Build & Push Docker Image
on:
push:
branches:
- main
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Login to Gitea Container Registry
run: |
echo "${{ secrets.REGISTRY_TOKEN }}" | docker login git.cloudarix.de \
-u "${{ secrets.REGISTRY_USER }}" \
--password-stdin
- name: Build Docker image
run: |
docker build \
-t git.cloudarix.de/ahmido/lms:${{ github.sha }} \
-t git.cloudarix.de/ahmido/lms:latest \
.
- name: Push Docker image
run: |
docker push git.cloudarix.de/ahmido/lms:${{ github.sha }}
docker push git.cloudarix.de/ahmido/lms:latest

View File

@ -63,9 +63,13 @@ class LanguageController extends Controller
public function update_property(Request $request, $id) public function update_property(Request $request, $id)
{ {
$property = LanguageProperty::findOrFail($id); $property = LanguageProperty::with('language:id,code')->findOrFail($id);
$property->update(['properties' => $request->all()]); $property->update(['properties' => $request->all()]);
if ($property->language) {
$this->languageService->forgetLanguageCache($property->language->code);
}
return back()->with('success', $property->name . ' translation successfully updated'); return back()->with('success', $property->name . ' translation successfully updated');
} }
@ -78,8 +82,10 @@ class LanguageController extends Controller
public function change_lang(Request $request) public function change_lang(Request $request)
{ {
Cache::forget($this->languageService->cacheKey); $locale = $request->locale;
$cookie = Cookie::forever('locale', $request->locale); $this->languageService->forgetLanguageCache($locale);
$cookie = Cookie::forever('locale', $locale);
return back()->withCookie($cookie); return back()->withCookie($cookie);
} }

View File

@ -86,9 +86,19 @@ class LanguageService extends MediaService
Language::where('id', $id)->update(['is_default' => true]); Language::where('id', $id)->update(['is_default' => true]);
} }
protected function getCacheKey(string $locale): string
{
return "{$this->cacheKey}_{$locale}";
}
public function forgetLanguageCache(string $locale): void
{
Cache::forget($this->getCacheKey($locale));
}
function setLanguageProperties(string $locale): void function setLanguageProperties(string $locale): void
{ {
$cacheKey = "{$this->cacheKey}_{$locale}"; $cacheKey = $this->getCacheKey($locale);
$cached = Cache::rememberForever($cacheKey, function () use ($locale) { $cached = Cache::rememberForever($cacheKey, function () use ($locale) {
$language = Language::where('code', $locale) $language = Language::where('code', $locale)