Add (category)

This commit is contained in:
2023-11-20 02:50:16 +08:00
parent 36f0588ef8
commit 3ed6215b16
3 changed files with 12 additions and 5 deletions

View File

@@ -2,7 +2,7 @@
namespace App\Providers;
use App\Views\Composers\ParentCategoryComposer;
use App\Views\Composers\CategoryComposer;
use Illuminate\Support\Facades\View;
use Illuminate\Support\ServiceProvider;
@@ -26,7 +26,7 @@ public function register()
public function boot()
{
// Using class based composers...
View::composer('front.layouts.partials.nav', ParentCategoryComposer::class);
View::composer('front.layouts.partials.nav', CategoryComposer::class);
}
}

View File

@@ -5,10 +5,10 @@
use App\Models\Category;
use Illuminate\View\View;
class ParentCategoryComposer
class CategoryComposer
{
public function compose(View $view)
{
$view->with('parent_categories', Category::whereNull('parent_id')->get());
$view->with('categories', Category::get());
}
}