This commit is contained in:
parent
96014dc222
commit
a11eeb94c7
32
.gitea/workflows/docker.yml
Normal file
32
.gitea/workflows/docker.yml
Normal 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
|
||||||
@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user