added tv page, small changes and fix bugs
This commit is contained in:
@@ -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');
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user