fixed hide menu with sidebar

master
A1Gard 1 day ago
parent a9d3fb27e9
commit 7d3e2d0cfc

@ -430,7 +430,7 @@ function showCatNested($cats, $parent = null)
{
$ret = "";
foreach ($cats as $cat) {
if ($cat->parent_id == $parent) {
if ($cat->parent_id == $parent & !$cat->hide) {
$ret .= "<li>";
$ret .= "<a href='" . $cat->webUrl() . "'>";
$ret .= $cat->name . '</a>';

@ -23,7 +23,7 @@ return new class extends Migration
$table->unsignedInteger('parent_id')->nullable()->default(null)->index();
$table->json('theme')->nullable();
$table->text('canonical')->nullable();
$table->boolean('hide')->default(true)->comment('hide in menu as sub group');
$table->boolean('hide')->default(false)->comment('hide in menu as sub group');
$table->softDeletes();
$table->timestamps();
});

@ -25,7 +25,7 @@ return new class extends Migration
$table->unsignedInteger('parent_id')->nullable()->default(null)->index();
$table->json('theme')->nullable();
$table->text('canonical')->nullable();
$table->boolean('hide')->default(true)->comment('hide in menu as sub category');
$table->boolean('hide')->default(false)->comment('hide in menu as sub category');
$table->softDeletes();
$table->timestamps();
});

@ -19,7 +19,7 @@
</h4>
<div class="side-data side-list">
<ul class="ps-3">
{!! showCatNested(\App\Models\Category::all(['id','name','parent_id','slug'])) !!}
{!! showCatNested(\App\Models\Category::where('hide',0) ->get(['id','name','parent_id','slug'])) !!}
</ul>
</div>
</div>

Loading…
Cancel
Save