To have a full control we will create a BaseRepository, initialize it with Model class instance within the constructor like so : So it will have a direct operations to the models and then to the tables in the database.
Let’s get an example of creating a single API endpoint within all of what we learned about: We have this category model ..
To prevent duplication and have a nice tidy code, we have this function.