In this video we are going to learn about how to create Product.
So let see how can we create product page.
First of all create new Livewire Component.
So switch to the command prompt and for creating new livewire component run the command.

php artisan make:livewire admin/AdminProductComponent

Now switch to the project and lets create the route for this AdminProductComponent So to go the web.php and here inside the admin route group create the route.

Route::get('/admin/products',AdminProductComponent::class)->name('admin.products');

Now open the AdminProductCompoent.php class file and write the following code.

<?php

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

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

class AdminProductComponent extends Component
{
use WithPagination;

public function render()
{
$products = Product::paginate(10);
return view('livewire.admin.admin-product-component',['products'=>$products])->layout('layouts.base');
}
}


Now open the admin-product-component.blade.php view file write the following 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 Products
</div>
<div class=\"col-md-6\">
<a href=\"#\" class=\"btn btn-success pull-right\">Add New</a>
</div>
</div>
</div>
<div class=\"panel-body\">
@if(Session::has('message'))
<div class=\"alert alert-success\" role=\"alert\">{{Session::get('message')}}</div>
@endif
<table class=\"table table-striped\">
<thead>
<tr>
<th>Id</th>
<th>Image</th>
<th>Name</th>
<th>Stock</th>
<th>Price</th>
<th>Sale Price</th>
<th>Category</th>
<th>Date</th>
<th>Action</th>
</tr>
</thead>
<tbody>
@foreach ($products as $product)
<tr>
<td>{{$product->id}}</td>
<td><img src=\"{{asset('assets/images/products')}}/{{$product->image}}\" width=\"60\" /></td>
<td>{{$product->name}}</td>
<td>{{$product->stock_status}}</td>
<td>{{$product->regular_price}}</td>
<td>{{$product->sale_price}}</td>
<td>{{$product->category->name}}</td>
<td>{{$product->created_at}}</td>
<td></td>
</tr>
@endforeach
</tbody>
</table>
{{$products->links()}}
</div>
</div>
</div>
</div>
</div>
</div>


now lets add the link for all products inside the admin menu.
So open the base layout file.
And inside this admin menu add the link.

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

Now its done so lets check it.
Switch to browser and refresh the page.
And here inside the admin menu you can see the All Products Link.
Now click on this link.
Here you can see the all products with pagination.
10 records are showing here.
If I click on next link you can see another 10 records.
So in this way you can create product page in laravel 8 ecommerce.