mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-18 15:50:50 +08:00
API: upload sections list
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Repositories;
|
||||
|
||||
use App\Auth\Permission;
|
||||
use App\Exceptions\InsufficientPermissionException;
|
||||
use App\Http\Middleware\Locale;
|
||||
use App\Models\Category;
|
||||
@@ -242,5 +243,20 @@ class SearchBoxRepository extends BaseRepository
|
||||
return Category::query()->whereIn('id', $idArr)->delete();
|
||||
}
|
||||
|
||||
public function listSections()
|
||||
{
|
||||
$modeIds = [SearchBox::getBrowseMode()];
|
||||
if (SearchBox::isSpecialEnabled() && Permission::canUploadToSpecialSection()) {
|
||||
$modeIds[] = SearchBox::getSpecialMode();
|
||||
}
|
||||
$searchBoxList = SearchBox::query()->with("categories")->find($modeIds);
|
||||
foreach ($searchBoxList as $searchBox) {
|
||||
if ($searchBox->showsubcat) {
|
||||
$searchBox->loadSubCategories();
|
||||
}
|
||||
}
|
||||
return $searchBoxList;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user