added tv page, small changes and fix bugs

This commit is contained in:
F4ilji
2025-05-21 14:00:04 +05:00
parent 10ec9a90c7
commit 791a56ca4d
12 changed files with 327 additions and 102 deletions
@@ -0,0 +1,14 @@
<?php
namespace App\Containers\Widget\UI\WEB\Controllers;
use App\Ship\Controllers\Controller;
use App\Ship\Requests\Request;
class TvController extends Controller
{
public function index()
{
return inertia()->render('Client/Tv/Index');
}
}
@@ -0,0 +1,14 @@
<?php
use App\Containers\Widget\UI\API\Controllers\ClientWidgetAdditionalEducationalProgramController;
use App\Containers\Widget\UI\API\Controllers\ClientWidgetContactController;
use App\Containers\Widget\UI\API\Controllers\ClientWidgetEducationalProgramController;
use App\Containers\Widget\UI\API\Controllers\ClientWidgetFormController;
use App\Containers\Widget\UI\API\Controllers\ClientWidgetPageController;
use App\Containers\Widget\UI\API\Controllers\ClientWidgetPageReferenceListController;
use App\Containers\Widget\UI\API\Controllers\ClientWidgetPostController;
use App\Containers\Widget\UI\API\Controllers\ClientWidgetSliderController;
use App\Containers\Widget\UI\WEB\Controllers\TvController;
use Illuminate\Support\Facades\Route;
Route::get('/tv/', [TvController::class, 'index'])->name('client.tv.post.index');
+27 -18
View File
@@ -21,29 +21,22 @@ class HandleInertiaRequests extends Middleware
public function share(Request $request): array
{
// Навигация (кешированная)
$navigation = Cache::remember('navigation', now()->addHours(1), function () {
return NavigationResource::collection(
MainSection::with('subSections.pages.section')
->orderBy('sort', 'asc')
->get()
);
});
// Хлебные крошки (автоматически по текущему URL)
$breadcrumbs = app(BreadcrumbService::class)->generateBreadcrumbs();
return [
...parent::share($request),
'auth' => [
'user' => $request->user() ? $request->user()->only('id', 'name', 'email', 'created_at') : null,
],
'ziggy' => fn () => [
...(new Ziggy)->toArray(),
'location' => $request->url(),
],
'navigation' => $navigation,
'breadcrumbs' => $breadcrumbs, // Добавляем хлебные крошки
// 'ziggy' => fn () => [
// ...(new Ziggy)->toArray(),
// 'location' => $request->url(),
// ],
'ziggy' => function() {
return array_merge((new Ziggy())->toArray(), [
'location' => url()->current(),
]);
},
'navigation' => $this->getNavigation(),
'breadcrumbs' => $this->getBreadcrumbs(),
'urlPrev' => function () {
if (url()->previous() !== url()->current()) {
return url()->previous();
@@ -52,4 +45,20 @@ class HandleInertiaRequests extends Middleware
},
];
}
private function getNavigation()
{
return Cache::remember('navigation', now()->addHours(1), function () {
return NavigationResource::collection(
MainSection::with('subSections.pages.section')
->orderBy('sort', 'asc')
->get()
);
});
}
private function getBreadcrumbs()
{
return app(BreadcrumbService::class)->generateBreadcrumbs();
}
}
@@ -20,6 +20,9 @@ class UserCacheService extends AbstractCacheService implements CacheInterface
public function clearAllCacheByModel(): void
{
$this->clearCacheByPrefix(CacheKeys::USER_PREFIX->value.'*');
$this->clearCacheByPrefix(CacheKeys::FACULTY_PREFIX->value.'*');
$this->clearCacheByPrefix(CacheKeys::DEPARTMENT_PREFIX->value.'*');
$this->clearCacheByPrefix(CacheKeys::DIVISION_PREFIX->value.'*');
}
public function getCachedData(string $key)