Unit of work has been implemented in our project next to what we have to do is insert bulky book where
project we first need to register that in our dependency injection now we no longer need the a category
repository.
The only thing that we want is unit of work.
If we did not have unit output but aren't in Europe, was it really that we added, we would have to
inject that manually.
But with a unit of work that will take care of repositories that we will add, we'll take care of all
the repositories that we will add in future.
This one injection is sufficient.
So if we go back to category controller here, we now need a unit of work that can call this unit of
work and we have the unit off work.
This will be a unit of work with the undisclosed unit after is equal to unit of work.
So now we are getting the unit of work using dependency injection.
How do we get all the categories inside unit of work?
Now we have the repository with the name of category on there, we have to get all method, so everything
stays the same.
We just need to change unit of worked category instead of underscore.
Where do we have the safe method?
We just moved the guard unit off work inside there.
We have the global safe method so that we in future, if we add some other model here and then we want
to save both of them together after we have both had statements.
We can just call one unit after that save.
Let native place the edit here.
Update your save will be unit tough work again.
And by the fact that I believe all the errors should be gone, let's run the application.
Everything will still be the same.
Let's go to a category.
And try to create a test category.
That works.
Let's try to edit that.
And let's try to delete this.
Perfect.
I love them is working as expected.