File manager - Edit - /var/www/payraty/helpdesk/app/Data/CategoryLoader.php
Back
<?php namespace App\Data; use App\Models\Category; class CategoryLoader { public function loadData(?string $loader): array { if (!$loader) { $loader = 'categoryPage'; } $categoryId = request()->route('sectionId') ?? request()->route('categoryId'); $category = Category::findOrFail($categoryId); $data = ['category' => $category, 'loader' => $loader]; if ($loader === 'categoryPage') { $data['categoryNav'] = (new ArticleLoader())->loadCategoryNav( $category->parent_id ?? $category->id, ); $data['articles'] = $category ->articles() ->filterByVisibleToRole() ->limit(40) ->get() ->loadPath($category); if ($category->is_section) { $category->load('parent'); } } return $data; } }
| ver. 1.4 |
Github
|
.
| PHP 8.3.30 | Generation time: 0.04 |
proxy
|
phpinfo
|
Settings