In this video we are going to learn about Delete Subcategory.
So lets see how can we Delete Subcategory.
Switch to the project and lets open the Admin Category Component class file and here lets create a function for deleting the subcategory.
So write here.

public function deleteSubcategory($id)
$scategory = Subcategory::find($id);
session()->flash('message','Subcategory has been deleted successfully!');

Now go to the Admin-category-component.blade.php view file and here inside the subcategory foreach lets create a link for delete the subcategory.

<ul class=\"sclist\">
@foreach($category->subCategories as $scategory)
<li><i class=\"fa fa-caret-right\"></i> {{$scategory->name}}
<a href=\"{{route('admin.editcategory',['category_slug'=>$category->slug,'scategory_slug'=>$scategory->slug])}}\" class=\"slink\"><i class=\"fa fa-edit\"></i></a>
<a href=\"#\" onclick=\"confirm('Are you sure, You want to delete this subcategory?') || event.stopImmediatePropagation()\" wire:click.prevent=\"deleteSubcategory({{$scategory->id}})\" class=\"slink\"><i class=\"fa fa-times text-danger\"></i></a>

Now lets write some css for this subcategory.
So here inside the style tage write the following css.

list-style: none;
.sclist li{
line-height: 33px;
border-bottom: 1px solid #ccc;
.slink i{

Now every thing is done so lets check.
So switch to the browser and refresh the page.
and here you can see the delte link.
Now lets delete any sub category.
So let click here for delteing this subcatory.
and here you can see the confirmation dialog box.
If I cancel this the subcategory is safe.
Now click one more time.
and this time click on ok.
and here you can subcategory has been deleted.
So in this way you can Delete Subcategory.