added feature for binding form to page and fixing bugs

This commit is contained in:
F4ilji
2025-04-22 21:15:03 +05:00
parent aea6304ac4
commit 45c84e7ffb
12 changed files with 107 additions and 9 deletions
@@ -141,11 +141,18 @@ class ClientAdditionalEducationController extends Controller
fn() => $this->seoPageProvider->getSeoForModel($additionalEducationModel)
);
if (array_key_exists('custom_form', request()->input('settings_page'))) {
$form = request()->input('settings_page')['custom_form'];
} else {
$form = null;
}
$additionalEducation = new AdditionalEducationResource($additionalEducationModel);
return Inertia::render('Client/Additional-educations/Show', compact(
'additionalEducation',
'seo'
'seo',
'form',
));
}}
+1 -1
View File
@@ -49,7 +49,7 @@ class MainController extends Controller
$educations = $this->getEducationsData();
$posts = Cache::remember('recent_posts', now()->addHour(), function () {
$posts = Cache::remember('posts_recent', now()->addHour(), function () {
return $this->getRecentPosts();
});
+2
View File
@@ -37,6 +37,7 @@ class PageController extends Controller
->first();
});
if ($page === null) {
abort(404);
}
@@ -51,6 +52,7 @@ class PageController extends Controller
abort($page->code);
}
return Inertia::render('Page', compact('page', 'subSectionPages', 'seo'));
}
}
+2
View File
@@ -32,6 +32,8 @@ class AccessCheck
abort($registeredRoute->code);
}
$request->merge(['settings_page' => $registeredRoute->settings]);
// Если все проверки пройдены, продолжаем выполнение запроса
return $next($request);
}
@@ -23,8 +23,9 @@ class FormTimePeriodMiddleware
abort(Response::HTTP_NOT_FOUND, 'Form not found');
}
if (!isset($form->settings['period'])) {
abort(Response::HTTP_BAD_REQUEST, 'Invalid form settings');
return $next($request);
}
$period = $form->settings['period'];