In this video we are going to learn about how to Admin Category Page.
So let see how can we create category page for the Admin.
So first of all lets login by the admin credentials.
After login you can see in admin menu there are two link one for the dashboard and another for the logout link.
Now lets create a new livewire component for categories.
Switch to the command prompt and for creating the livewire component run the command.

php artisan make:livewire admin/AdminCategoryComponent

Now switch to the project And lets create the route for the category component
So go inside the routes directory then open web.php file.
Inside the admin middleware group lets create the route

Route::get('/admin/categories',AdminCategoryComponent::class)->name('admin.categories');


Now open the base.blade.php layout file.
Inside this layout file lets find the admin menu.
Before the logout link lets create link for the category so add the follwing code.

<li class=\"menu-item\" >
<a title=\"Categories\" href=\"{{ route('admin.categories') }}\">Categories</a>
</li>


Now lets open the AdminCategoriesComponent.php Class file and add the code.

<?php

namespace App\\Http\\Livewire\\Admin;

use App\\Models\\Category;
use Livewire\\Component;
use Livewire\\WithPagination;

class AdminCategoryComponent extends Component
{
use WithPagination;

public function render()
{
$categories = Category::paginate(5);
return view('livewire.admin.admin-category-component',['categories'=>$categories])->layout('layouts.base');
}
}


Alright now open admin-category-component.blade.php view file write the follwing code.


<div>
<style>
nav svg{
height: 20px;
}
nav .hidden{
display: block !important;
}
</style>
<div class=\"container\" style=\"padding:30px 0;\">
<div class=\"row\">
<div class=\"col-md-12\">
<div class=\"panel panel-default\">
<div class=\"panel-heading\">
<div class=\"row\">
<div class=\"col-md-6\">
All Categories
</div>
<div class=\"col-md-6\">
<a href=\"#\" class=\"btn btn-success pull-right\">Add New</a>
</div>
</div>
</div>
<div class=\"panel-body\">
<table class=\"table table-striped\">
<thead>
<tr>
<th>Id</th>
<th>Category Name</th>
<th>Slug</th>
<th>Action</th>
</tr>
</thead>
<tbody>
@foreach ($categories as $category)
<tr>
<td>{{$category->id}}</td>
<td>{{$category->name}}</td>
<td>{{$category->slug}}</td>
<td></td>
</tr>
@endforeach
</tbody>
</table>
{{$categories->links()}}
</div>
</div>
</div>
</div>
</div>
</div>


Now its done lets check it
So first of all run the application
Switch to the command prompt and type the command

php artisan serve


Now switch to the browser and refresh the page.
Inside the admin menu you can see here the category link now click on it.
Now you see here the categories.
So in this way you can create Admin Category Page in laravel 8 ecommerce.