Merge branch 'feat/wiki' into 'main'

Feat/wiki

See merge request jjimenez/safekat!582
This commit is contained in:
Alvaro
2025-03-02 12:44:46 +00:00
10 changed files with 114 additions and 43 deletions

View File

@ -53,7 +53,7 @@ class WikiController extends BaseController
$this->viewData['slug'] = $slug;
$this->viewData['section'] = $section->withAll($this->locale);
$this->viewData['breadcrumb'] = [
['title' => lang("Wiki." . $section->slug), 'route' => route_to('showWikiPage', $slug), 'active' => true],
['title' => $section->name->{$this->locale}, 'route' => route_to('showWikiPage', $slug), 'active' => true],
];
return view('themes/vuexy/wiki/pages/render', $this->viewData);
}else{
@ -173,8 +173,9 @@ class WikiController extends BaseController
$bodyData = $this->request->getPost();
$sectionName = $bodyData['name'];
$roles = $bodyData['roles'];
$bodyData["slug"] = implode('-', array_map(fn($e) => strtolower($e), explode(' ', $sectionName)));
$bodyData["slug"] = implode('-', array_map(fn($e) => strtolower($e), explode(' ', $sectionName['es'])));
$bodyData["order"] = $this->wikiSectionModel->selectMax('order')->first()->order + 1;
$bodyData['name'] = json_encode($sectionName);
$wikiSectionId = $this->wikiSectionModel->insert($bodyData);
if(count($roles) > 0){
foreach ($roles as $key => $role) {
@ -193,7 +194,7 @@ class WikiController extends BaseController
$wikiSectionId = $bodyData['wiki_section_id'];
$roles = $bodyData['roles'];
$this->wikiSectionModel->update($wikiSectionId, [
"name" => $bodyData['name'],
"name" => json_encode($bodyData['name']),
"icon" => $bodyData['icon']
]);
$this->wikiSectionRoleModel->where('wiki_section_id',$wikiSectionId)->delete();